Ejemplo n.º 1
0
    private IEnumerator Accept(string source)
    {
        var tokens = source.Split('\n');

        for (int i = 0; i < tokens.Length; i++)
        {
            if (tokens[i] == "DialogOpen")
            {
                yield return(StartCoroutine(OpenDialogBox()));
            }
            else if (tokens[i] == "DialogClose")
            {
                yield return(StartCoroutine(CloseDialogBox()));
            }
            else if (tokens[i].StartsWith("Text"))
            {
                var values = tokens[i].Split('|');
                var data   = new TextStruct()
                {
                    Text = values[1], SpeakerId = values[2], FaceId = values[3]
                };
                yield return(StartCoroutine(TextDisplay(data)));
            }
        }
    }
Ejemplo n.º 2
0
        public PeekerStats(string htmlTagText)
        {
            Name = new TextStruct(@"StatsName: (?<Q>.+) Average", htmlTagText);

            Site = new TextStruct(@"Site: (?<Q>\w+) Average", htmlTagText);

            AvgFinish = new TextStruct(@"Average Finish: (?<Q>\d+/\d+)", htmlTagText);

            AvgEntrants = new AvgStruct(@"Average Entrants: *(?<Q>[0-9,.]+)", htmlTagText);

            AvgBuyin = new MonStruct(@"Average Buyin: *\$(?<Q>[0-9,.]+)", htmlTagText);

            AvgProfit = new MonStruct(@"Average Profit: *(?<Q>[-$0-9,.]+)", htmlTagText);

            Profit = new MonStruct(@"Est\. Profit: *(?<Q>[-$0-9,.]+)", htmlTagText);

            PercROI = new PercStruct(@"ROI:  *(?<Q>[-0-9,.]+)%", htmlTagText);

            PercITM = new PercStruct(@"ITM:  *(?<Q>[-0-9,.]+)%", htmlTagText);

            PercFinalTables = new PercStruct(@"Final Tables:  *\d+ *\((?<Q>[-0-9,.]+)%\)", htmlTagText);

            PercWins = new PercStruct(@"Wins:  *\d+ *\((?<Q>[-0-9,.]+)%\)", htmlTagText);

            GamesPlayed = new AvgStruct(@"Games Played: *(?<Q>[0-9,.]+)", htmlTagText);
        }
Ejemplo n.º 3
0
    public IEnumerator SetText(TextStruct data)
    {
        DialogText.text = string.Empty;
        bool isRapidMode = false;
        int  count       = 0;

        while (count <= data.Text.Length)
        {
            DialogText.text = data.Text.Substring(0, count);
            count++;
            if (isRapidMode)
            {
                yield return(new WaitForSeconds(0.01f));
            }
            else
            {
                yield return(new WaitForSeconds(0.02f));
            }
            if (Input.GetButtonDown(ButtonsName.ButtonA))
            {
                isRapidMode = true;
            }
        }
        while (true)
        {
            if (Input.GetButtonDown(ButtonsName.ButtonA))
            {
                yield break;
            }
            yield return(null);
        }
    }
Ejemplo n.º 4
0
    public void SetText(string _name)
    {
        if (setName == null)
        {
            UILabel namelab = UIUtil.Str2CentLab(this.gameObject, _name, name_font, colorName);
            namelab.gameObject.SetActive(true);
            namelab.gameObject.transform.localPosition = Vector3.zero;
            namelab.effectStyle = UILabel.Effect.Outline;
            namelab.gameObject.transform.localScale = new Vector3(fontSize, fontSize, 1f);
            namelab.depth          = 2;
            namelab.overflowMethod = UILabel.Overflow.ResizeFreely;
            namelab.pivot          = UIWidget.Pivot.Bottom;

            TextStruct str = new TextStruct();
            str.lab = namelab;
            setName = str;

            //if (spriteBgAtlas != null)
            //{
            //    UISprite sprite = NGUITools.AddSprite(this.gameObject, spriteBgAtlas, spriteBgName);
            //    sprite.depth = namelab.depth - 1;
            //    sprite.type = UISprite.Type.Simple;
            //    string[] nameArray = _name.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
            //    int maxLength = 6;
            //    foreach (var item in nameArray)
            //    {
            //        maxLength = Mathf.Max(maxLength, item.Length);
            //    }
            //    sprite.color = new Color(0, 0, 0, 0.5f);
            //    sprite.transform.localScale = new Vector3(maxLength * fontSize * bgRate, nameArray.Length * fontSize * bgRate, 1);//宽度是6和最长单行字符串长度中比较大的值,高度时字符串行数 by吴江
            //    //==========================
            //    sprite.transform.localPosition = new Vector3(namelab.transform.localPosition.x,
            //        namelab.transform.localPosition.y, namelab.transform.localPosition.z + 0.1f);
            //    str.spriteBg = sprite.gameObject;
            //}
        }
        else
        {
            setName.lab.text = _name;
        }
    }
Ejemplo n.º 5
0
 private static void NextTextbox()
 {
     showingText     = false;
     showingQuestion = false;
     if (textboxes.Count != 0)
     {
         TextStruct text = textboxes.Dequeue();
         if (text.isQuestion)
         {
             showingQuestion = true;
             gameObject.AddComponent <QuestionBox>()
             .Setup(text.text, text.callback);
         }
         else
         {
             showingText = true;
             gameObject.AddComponent <Textbox>()
             .Setup(text.name, text.text, text.blocking, text.callback);
         }
     }
 }
Ejemplo n.º 6
0
    public static void Create(string name, string[] text, bool question = false, bool blocking = true,
                              QuestionBox.OnAnswer callback             = null)
    {
        // Set up static instances if we haven't yet
        if (gameObject == null)
        {
            Setup();
        }
        // Add textbox to the queue
        TextStruct textStruct = new TextStruct();

        textStruct.name       = name;
        textStruct.text       = text;
        textStruct.blocking   = blocking;
        textStruct.isQuestion = question;
        textStruct.callback   = callback;
        textboxes.Enqueue(textStruct);

        // If we're not showing anything, show the next one
        if (!showingText && !showingQuestion)
        {
            NextTextbox();
        }
    }
Ejemplo n.º 7
0
 private IEnumerator TextDisplay(TextStruct data)
 {
     yield return(StartCoroutine(mDialogManager.SetText(data)));
 }
Ejemplo n.º 8
0
        public BinaryReaderX createCfg(int part)
        {
            long bk;

            BinaryWriterX br = new BinaryWriterX(new MemoryStream());

            br.WriteStruct <Header>(headerList[part]);

            for (int j = 0; j < editorEntries[part].Count; j++)
            {
                if (j > 0)
                {
                    EditorStruct bk2 = editorEntries[part][j];

                    var success1 = (headerList[part].dataOffset > br.BaseStream.Length) ? bk2.entryOffset = 0 : bk2.entryOffset = (uint)br.BaseStream.Length - headerList[part].dataOffset;

                    bk = br.BaseStream.Position;
                    var success2 = (headerList[part].dataOffset > br.BaseStream.Length) ? br.BaseStream.Position = headerList[part].dataOffset : br.BaseStream.Position = br.BaseStream.Length;
                    br.Write(Encoding.GetEncoding("shift-jis").GetBytes(Labels[labelCount++].Text));
                    br.Write((byte)0x00);
                    br.BaseStream.Position = bk;

                    editorEntries[part][j] = bk2;
                }

                br.WriteStruct <EditorStruct>(editorEntries[part][j]);
            }

            if (editorRest[part] != null)
            {
                br.Write(editorRest[part]);
            }
            else
            {
                for (int j = 0; j < textEntries[part].Count; j++)
                {
                    if (j > 0 && textEntries[part][j].entryOffset != 0xFFFFFFFF)
                    {
                        TextStruct bk2 = textEntries[part][j];

                        var success1 = (headerList[part].dataOffset > br.BaseStream.Length) ? bk2.entryOffset = 0 : bk2.entryOffset = (uint)br.BaseStream.Length - headerList[part].dataOffset;

                        bk = br.BaseStream.Position;
                        var success2 = (headerList[part].dataOffset > br.BaseStream.Length) ? br.BaseStream.Position = headerList[part].dataOffset : br.BaseStream.Position = br.BaseStream.Length;
                        br.Write(Encoding.GetEncoding("shift-jis").GetBytes(Labels[labelCount++].Text));
                        br.Write((byte)0x00);
                        br.BaseStream.Position = bk;

                        textEntries[part][j] = bk2;
                    }

                    br.WriteStruct <TextStruct>(textEntries[part][j]);
                }
                if (textRest[part] != null)
                {
                    br.Write(textRest[part]);
                }
            }

            br.BaseStream.Position = 0x8;
            br.Write((int)(br.BaseStream.Length - headerList[part].dataOffset));

            br.BaseStream.Position = br.BaseStream.Length;
            while (br.BaseStream.Position % 16 != 0)
            {
                br.Write((byte)0xFF);
            }

            return(new BinaryReaderX(br.BaseStream));
        }