示例#1
0
 protected void Init()
 {
     this.massage      = this.text;
     this.nowscene     = CommandMessage.SCENE.printing;
     this.fasepattern  = CommandMessage.FACEPATTERN.neutral;
     this.endprint     = 0;
     this.printfonts   = 0;
     this.arrowprint   = false;
     this.faseflame    = 0;
     this.frame        = 0;
     this.manyopen     = 0;
     this.fasewait     = 0;
     this.wait         = 0;
     this.shortmassage = new string[3];
     this.canskip      = true;
     this.longwaiting  = false;
     this.shortmassage = new string[3] {
         "", "", ""
     };
     this.parallelEventManagers = new List <EventManager>();
 }
示例#2
0
        public override void Update()
        {
            string[][] strArray = new string[3][]
            {
                this.ToDecomposition(this.massage[0]),
                this.ToDecomposition(this.massage[1]),
                this.ToDecomposition(this.massage[2])
            };
            foreach (var parallelEvents in this.parallelEventManagers.Where(em => em.playevent))
            {
                parallelEvents.UpDate();
            }
            if (this.manager.alpha <= 0 && this.canskip && this.massage[0].Length > 0 && (Input.IsPress(Button._B) || Input.IsPress(Button._A) || this.fastprint))
            {
                this.endprint     = strArray.Length - 1;
                this.printfonts   = strArray[strArray.Length - 1].Length + 1;
                this.shortmassage = this.massage;
            }
            switch (this.nowscene)
            {
            case CommandMessage.SCENE.printing:
                ++this.printfonts;
                if (this.endprint >= strArray.Length || this.printfonts > strArray[this.endprint].Length)
                {
                    this.printfonts = 0;
                    ++this.endprint;
                    var parallelComplete = this.parallelEventManagers.All(em => !em.playevent);
                    var endOfMessage     = this.endprint >= this.massage.Length;
                    this.noTalk = endOfMessage;
                    if (parallelComplete && endOfMessage)
                    {
                        this.arrowprint = true;
                        this.nowscene   = CommandMessage.SCENE.pushA;
                        break;
                    }
                    break;
                }
                // ISSUE: explicit reference operation
                this.shortmassage[this.endprint] += strArray[this.endprint][this.printfonts - 1];
                var inEllipsesFunc = new Func <string[], int, int>(
                    (str, index) => {
                    if ((str[index] != "." && str[index] != "・") ||
                        index + 1 >= str.Length ||
                        (index >= 2 && str[index - 2] == "D" && str[index - 1] == "r") ||
                        (index >= 2 && str[index - 2] == "M" && str[index - 1] == "r") ||
                        (index >= 2 && str[index - 2] == "M" && str[index - 1] == "s"))
                    {
                        return(0);
                    }
                    var seq = 1;
                    for (int d = 1; index + d < str.Length && (str[index + d] == "." || str[index + d] == "・"); d += 1)
                    {
                        seq += 1;
                    }

                    for (int d = 1; index - d >= 0 && (str[index - d] == "." || str[index - d] == "・"); d += 1)
                    {
                        seq += 1;
                    }

                    return(seq);
                });
                var ellipseLength = inEllipsesFunc(strArray[this.endprint], this.printfonts - 1);
                var shortpause    = strArray[this.endprint][this.printfonts - 1] == "、" || strArray[this.endprint][this.printfonts - 1] == ",";
                var thinkStart    = strArray[this.endprint][this.printfonts - 1] == "(" || strArray[this.endprint][this.printfonts - 1] == "(";
                if (ellipseLength > 0 && !this.mono)
                {
                    this.sound.PlaySE(SoundEffect.message);
                    this.wait        = 30 / ellipseLength;
                    this.longwaiting = true;
                }
                else if (shortpause && !this.mono)
                {
                    this.sound.PlaySE(SoundEffect.message);
                    this.wait        = 15;
                    this.longwaiting = true;
                }
                else if (thinkStart && !this.mono)
                {
                    this.noTalk = true;
                }
                else
                {
                    try
                    {
                        var thinkStop = strArray[this.endprint][this.printfonts - 2] == ")" || strArray[this.endprint][this.printfonts - 2] == ")";
                        if (thinkStop && !this.mono)
                        {
                            this.noTalk = false;
                        }
                    }
                    catch
                    {
                    }
                    if (strArray[this.endprint][this.printfonts - 1] == "#")
                    {
                        string s = "";
                        for (int index = 2; index < 100 && (this.printfonts + index < strArray[this.endprint].Length && !(strArray[this.endprint][this.printfonts + index] == "#")); ++index)
                        {
                            s += strArray[this.endprint][this.printfonts + index];
                        }
                        string str = strArray[this.endprint][this.printfonts];
                        switch (str)
                        {
                        case "s":
                            try
                            {
                                this.sound.PlaySE((SoundEffect)Enum.Parse(typeof(SoundEffect), s));
                            }
                            catch { }
                            break;

                        case "w":
                            try
                            {
                                this.wait        = int.Parse(s);
                                this.longwaiting = true;
                            }
                            catch { }
                            break;

                        case "b":
                            try
                            {
                                this.canskip = bool.Parse(s);
                            }
                            catch { }
                            break;

                        case "u":
                            var saveThread = new Thread(new ThreadStart(() => this.savedata.SaveFile(this.manager.parent.parent)));
                            this.manager.parent.main.FolderSave();
                            this.savedata.saveEnd = false;
                            saveThread.Start();
                            this.saving = true;
                            break;

                        case "e":
                            this.Init();
                            this.EndCommand();
                            return;

                        case "p":
                            var newEventManager = new EventManager(this.manager.parent, this.sound);
                            newEventManager.AddEvent(new RunEvent(this.sound, newEventManager, s, -1, newEventManager.parent, newEventManager.parent.Field, this.savedata));
                            this.parallelEventManagers.Add(newEventManager);
                            break;
                        }
                        do
                        {
                            ++this.printfonts;
                            // ISSUE: explicit reference operation
                            this.shortmassage[this.endprint] += strArray[this.endprint][this.printfonts - 1];
                        }while (strArray[this.endprint][this.printfonts - 1] != "#");
                    }
                    else
                    {
                        this.sound.PlaySE(SoundEffect.message);
                        this.wait        = 0;
                        this.longwaiting = false;
                    }
                }
                this.nowscene = CommandMessage.SCENE.wait;
                break;

            case CommandMessage.SCENE.wait:
                --this.wait;
                if (this.wait <= 0)
                {
                    this.wait     = 0;
                    this.nowscene = CommandMessage.SCENE.printing;
                    break;
                }
                break;

            case CommandMessage.SCENE.pushA:
                this.FlameControl(4);
                if (this.savedata != null)
                {
                    if (this.savedata.saveEnd)
                    {
                        if (!this.endok)
                        {
                            if (this.frame > 1)
                            {
                                this.frame = 0;
                                this.endok = true;
                                break;
                            }
                            break;
                        }
                        if (this.frame > 2)
                        {
                            this.frame = 0;
                        }
                        if (this.manager.alpha <= 0 && (Input.IsPress(Button._A) || Input.IsPress(Button._B) || this.saving))
                        {
                            this.Init();
                            this.EndCommand();
                            return;
                        }
                        break;
                    }
                    break;
                }
                if (!this.endok)
                {
                    if (this.frame > 1)
                    {
                        this.frame = 0;
                        this.endok = true;
                    }
                }
                else
                {
                    if (this.frame > 2)
                    {
                        this.frame = 0;
                    }
                    if (this.manager.alpha <= 0 && (Input.IsPress(Button._A) || Input.IsPress(Button._B)))
                    {
                        this.Init();
                        this.EndCommand();
                        return;
                    }
                }
                break;
            }
            if (!this.printfase || this.mono)
            {
                return;
            }
            this.FaseAnimation();
        }