Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

テキストの表示速度倍速に

  • Loading branch information...
commit fe3c155890e794fc67cd178a513469a10a4dd45b 1 parent 2b8eea7
giginet authored
1  Heqet/sprite/KWMessageWindow.h
@@ -33,6 +33,7 @@
33 33
34 34 @property(readwrite) int currentMessageIndex;
35 35 @property(readwrite) int currentTextIndex;
  36 +@property(readwrite) int updateTextLength;
36 37 @property(readwrite) double messageSpeed;
37 38 @property(readwrite) double autoSkipDelay;
38 39 @property(readwrite, strong) NSMutableArray* messages;
9 Heqet/sprite/KWMessageWindow.m
@@ -18,6 +18,7 @@ - (void)onNextMessage:(id)timer;
18 18 @implementation KWMessageWindow
19 19 @synthesize currentMessageIndex = currentMessageIndex_;
20 20 @synthesize currentTextIndex = currentTextIndex_;
  21 +@synthesize updateTextLength;
21 22 @synthesize messageSpeed = messageSpeed_;
22 23 @synthesize autoSkipDelay;
23 24 @dynamic currentMessage;
@@ -32,6 +33,7 @@ - (id)init {
32 33 self.currentMessageIndex = 0;
33 34 self.messageSpeed = 1.0 / [[KKStartupConfig config] maxFrameRate];
34 35 self.autoSkipDelay = 0;
  36 + self.updateTextLength = 1;
35 37 messages_ = [NSMutableArray array];
36 38 timer_ = [KWTimer timerWithMax:self.messageSpeed];
37 39 timer_.looping = YES;
@@ -148,9 +150,12 @@ - (void)update:(ccTime)dt {
148 150
149 151 - (void)updateMessage {
150 152 if ([self isEndMessage]) return;
151   - ++self.currentTextIndex;
152   - //NSString* text = [self.currentMessage substringWithRange:NSMakeRange(self.currentTextIndex, 1)];
153 153 NSString* text = @"";
  154 + if (self.currentTextIndex + self.updateTextLength < (int)[self.currentWholeMessage length]) {
  155 + self.currentTextIndex += self.updateTextLength;
  156 + } else {
  157 + self.currentTextIndex = self.currentWholeMessageLength - 1;
  158 + }
154 159 [self.delegate didUpdateText:self text:text];
155 160 if ([self isEndMessage]) {
156 161 [self onCompleteMessage];
1  Projectfiles/MessageWindow.m
@@ -31,6 +31,7 @@ - (id)initWithMessages:(NSArray *)messages alignment:(UITextAlignment)alignment
31 31 if (self) {
32 32 self.delegate = self;
33 33 self.autoSkipDelay = 0.5;
  34 + self.updateTextLength = 2;
34 35 shadowLabel_ = [CCLabelTTF labelWithString:self.messageLabel.string
35 36 dimensions:self.messageLabel.contentSize
36 37 alignment:alignment

0 comments on commit fe3c155

Please sign in to comment.
Something went wrong with that request. Please try again.