Exemple #1
0
        ///<summary>
        ///Returns a string containing the element from the current segment.
        ///</summary>
        ///<param name="elementNumber">The element number that you want to return</param>
        public String Element(int elementNumber)
        {
            int count        = 0;
            int startIndex   = 0;
            int endIndex     = 0;
            int currentIndex = 0;

            while (count < elementNumber && currentIndex != -1)
            {
                currentIndex = LineText.IndexOf(x12File.elementDelimiter, startIndex);
                startIndex   = currentIndex + 1;
                count++;
            }

            if (currentIndex != -1)
            {
                endIndex = LineText.IndexOf(x12File.elementDelimiter, startIndex);
                if (endIndex == -1)
                {
                    endIndex = LineText.Length;
                }
                return(LineText.Substring(startIndex, endIndex - startIndex));
            }
            else
            {
                return(String.Empty);
            }
        }
        void RichTextLightLine(RichTextBox richText, int lineNum)
        {
            int startIndex = GetStartIndex(richText, lineNum);

            LineText.Select(startIndex, richText.Lines[lineNum].Length);
            LineText.SelectionColor = valueColor;
        }
Exemple #3
0
        /// <param name="lines"></param>
        /// <param name="removeFinalLineBreak">
        /// True to remove the trailing line-break. This is due to an extra linebreak being
        /// appended in other section of code TODO: identify where the the other code
        /// exists.
        /// </param>
        public static string WriteLineTextArrayToList(List <LineText> lines, bool removeFinalLineBreak)
        {
            StringBuilder sb      = new StringBuilder(1000);
            const string  pilcrow = "¶";

            //for (int i = 0; i < Lines.Count; i++)
            for (int i = 0; i < lines.Count - 1; i++)
            {
                LineText item = lines[i];
                sb.Append(item.Text.Replace(pilcrow, string.Empty));
                // DMW_Added
                //if(item.Text.Length > 0)
                //{
                sb.Append("\r\n");
                //}
            }
            // DMW_Changed
            //if (removeFinalLineBreak && sb.Length > 0 && (sb[sb.Length - 1] == '\n' || sb[sb.Length - 1] == '\r'))
            //{
            //    sb.Remove(sb.Length - 1, 1);
            //}
            if (removeFinalLineBreak && sb.Length > 0 && (sb.ToString().EndsWith("\r\n")))
            {
                sb.Remove(sb.Length - 2, 2);
            }
            return(sb.ToString());
        }
Exemple #4
0
    public void showTextFixed(string text, float time, int jointIndex, Vector3 dir, float fontSize, Vector3 pos)
    {
        LineText lt = Instantiate(lineTextPrefab).GetComponent <LineText>();

        lt.setPropsWithFixedPos(pos, lookAtTarget, text, time, jointIndex, dir, fontSize, textSmooth, circleSize);
        //lt.transform.parent = transform;
    }
Exemple #5
0
    public void addToHashTable(int lineNumber, string text)
    {
        count++;
        LineText combo = new LineText(lineNumber, text);

        lineTextListHashtable.Add(count, combo);
    }
        public void LightCurrentLine()
        {
            int curCodeIndex = InterpretController.Instance.curCodeIndex;

            if (curCodeIndex != 0)
            {
                if (!needRecord)
                {
                    CodeText.Select(0, CodeText.Text.Length);
                    CodeText.SelectionColor = Color.Black;

                    LineText.Select(0, LineText.Text.Length);
                    LineText.SelectionColor = Color.Black;
                }
                List <Instruction> codeList = InterpretController.Instance.codeList;
                int startIndex = GetStartIndex(CodeText, curCodeIndex);
                CodeText.Select(startIndex, CodeText.Lines[curCodeIndex].Length);
                CodeText.SelectionColor = Color.Red;

                int lineIndex = CompileController.Instance.GetInstuctionLineIndex(curCodeIndex);
                startIndex = GetStartIndex(LineText, lineIndex);
                LineText.Select(startIndex, LineText.Lines[lineIndex].Length);
                LineText.SelectionColor = Color.Red;
            }
        }
Exemple #7
0
 /// <summary>
 /// Example ToString implementation, update/replace as desired
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(string.Format("{0}Quantity: {1:00}\tPer Unit: £ {2:#,0.00}{5}\tDiscount: {3:00} %\tSubTotal: £ {4:#,0.00}",
                          LineText.PadRight(20),
                          Quantity,
                          UnitPrice,
                          Discount,
                          SubTotal,
                          Taxable ? "T" : null));
 }
Exemple #8
0
        /// <summary>
        /// Gets lines of context around the line that matches the search parameter
        /// </summary>
        /// <param name="result">The match result to add context lines to</param>
        /// <param name="fileText">The file being searched</param>
        /// <param name="lineBreakIndexes">List of indexes to line breaks in the file string</param>
        private void getContext(SearchResult result, String fileText, List <int> lineBreakIndexes)
        {
            if (result.MatchLine.LineNumber > 0)
            {
                int contextLines = 0;
                for (int i = result.MatchLine.LineNumber - 1; i >= 0 && contextLines < Settings.get().ContextLineCount; i--)
                {
                    contextLines++;
                    LineText contextLine = new LineText();
                    contextLine.LineNumber = i;
                    int startIndex = lineBreakIndexes[i] + 1;
                    int endIndex;
                    if (i == lineBreakIndexes.Count - 1)
                    {
                        endIndex = fileText.Length;
                    }
                    else
                    {
                        endIndex = lineBreakIndexes[i + 1];
                    }
                    if (startIndex < endIndex)
                    {
                        contextLine.Text = fileText.Substring(startIndex, endIndex - startIndex);
                        result.BeforeContext.Add(contextLine);
                    }
                }
            }

            if (result.MatchLine.LineNumber < lineBreakIndexes.Count - 1)
            {
                int contextLines = 0;
                for (int i = result.MatchLine.LineNumber + 1; i < lineBreakIndexes.Count && contextLines < Settings.get().ContextLineCount; i++)
                {
                    contextLines++;
                    LineText contextLine = new LineText();
                    contextLine.LineNumber = i;
                    int startIndex = lineBreakIndexes[i] + 1;
                    int endIndex;
                    if (i == lineBreakIndexes.Count - 1)
                    {
                        endIndex = fileText.Length;
                    }
                    else
                    {
                        endIndex = lineBreakIndexes[i + 1];
                    }
                    if (startIndex < endIndex)
                    {
                        contextLine.Text = fileText.Substring(startIndex, endIndex - startIndex);
                        result.AfterContext.Add(contextLine);
                    }
                }
            }
        }
Exemple #9
0
 ///<summary>
 ///Replace an element within this segment.
 ///</summary>
 ///<param name="elementNumber">The element that you want to replace.</param>
 ///<param name="value">The string value with which you want to replace the element.</param>
 public bool replaceElement(int elementNumber, String value)
 {
     String[] elements = LineText.Split(x12File.elementDelimiter);
     if (elementNumber < elements.Length && elementNumber > 0)
     {
         elements[elementNumber] = value;
         this.LineText           = String.Join(x12File.elementDelimiter.ToString(), elements);
         return(true);
     }
     return(false);
 }
Exemple #10
0
        /// <summary>
        /// Show selections.
        /// </summary>
        /// <param name="selections">String content of selections</param>
        public void Select(string message, List <string> selections)
        {
            const int lineHeight = 30;
            const int lineGap    = 5;

            var startY = (Globals.WindowHeight - (selections.Count + 1) * (lineHeight + lineGap)) / 2;

            _messageText = new LineText(null,
                                        new Vector2(0, startY),
                                        Globals.WindowWidth,
                                        lineHeight,
                                        LineText.Align.Center,
                                        message,
                                        new Color(255, 215, 0) * 0.8f,
                                        Globals.FontSize12);

            startY += (lineHeight + lineGap);

            _selectionLineTexts = new List <LineText>();
            var index = 0;

            foreach (var selection in selections)
            {
                var textGui = new LineText(null,
                                           new Vector2(0, startY),
                                           Globals.WindowWidth,
                                           lineHeight,
                                           LineText.Align.Center,
                                           selection,
                                           _normalColor,
                                           Globals.FontSize12);

                textGui.MouseEnter += (arg1, arg2) => textGui.DrawColor = _selectionColor;
                textGui.MouseLeave += (arg1, arg2) => textGui.DrawColor = _normalColor;
                var currentIndex = index;
                textGui.MouseLeftDown += (arg1, arg2) =>
                {
                    IsInSelecting = false;
                    Selection     = currentIndex;
                    IsShow        = false;
                };

                _selectionLineTexts.Add(textGui);

                startY += (lineHeight + lineGap);
                index  += 1;
            }

            IsInSelecting = true;
            IsShow        = true;
        }
Exemple #11
0
        private static void ProtocolReaderLineAnalyze()
        {
            LineDesc = "";
            LineContect.Clear();

            string[] words1      = LineText.Split(strSeparators1, StringSplitOptions.RemoveEmptyEntries);
            string   str_contect = words1[0].Trim();

            if (words1.Length >= 2)
            {
                LineDesc = words1[1].Trim();
            }
            LineContect = str_contect.Split(strSeparators2, StringSplitOptions.RemoveEmptyEntries).ToList();
        }
        private static void WriteLine(this LineText lt, MWord.Range range, WdOMathJc justify = WdOMathJc.wdOMathJcLeft, int fontsize = 12, int leftIndent = 0, int spaceAfter = 0, int bold = 0)
        {
            if ((lt.TextContent == null) || (lt.TextContent?.Length == 0))
            {
                return;
            }
            range.Text = lt.TextContent;
            var mathRange   = range.OMaths.Add(range);
            var currentMath = mathRange.OMaths[1];

            currentMath.Range.Font.Bold = bold;
            currentMath.Range.Font.Size = fontsize;
            currentMath.Justification   = justify;
            currentMath.BuildUp();
            currentMath.Range.Paragraphs.LeftIndent = leftIndent;
            currentMath.Range.Paragraphs.SpaceAfter = spaceAfter;
            range.InsertParagraphAfter();
        }
Exemple #13
0
        internal int AddFixedSegment(int segmentTextStart, int segmentTextEnd)
        {
            if (segmentTextEnd < segmentTextStart)
            {
                return(-1);
            }

            LineSegments.Add(
                new PcLineSegment(
                    LineText.Substring(
                        segmentTextStart,
                        segmentTextEnd - segmentTextStart + 1
                        )
                    )
                );

            //Return the location of the start of the next segment
            return(segmentTextEnd + 1);
        }
        public CommandQueue(string TaskScript, WebBrowser wb, FrmShowImage objShowImg, Control ctrl)
        {
            control = ctrl;
            //Commands.Clear();
            ProceQueue.Clear();
            string BodyText = TaskScript;

            string[] CL = BodyText.Split(';');
            foreach (string LineText in CL)
            {
                IEvent e = new Event();
                Regex  r = new Regex(@"[a-z]*\(", RegexOptions.IgnoreCase);
                Match  m = r.Match(LineText.Trim());
                if (m.Success)
                {
                    e.Webbrowser    = wb;
                    e.Detail        = LineText.Trim();
                    e.ShowImageForm = objShowImg;
                    e.Command       = CommandHelper.GetCommandByName(m.Value.Remove(m.Value.Length - 1, 1));
                    r = new Regex(@"\([\s\S]*\)", RegexOptions.IgnoreCase);
                    m = r.Match(LineText.Trim());
                    if (m.Success)
                    {
                        string ts = m.Value.Remove(m.Value.Length - 1, 1);
                        ts = ts.Remove(0, 1);
                        string[] sl = ts.Split(',');
                        foreach (string s in sl)
                        {
                            e.Data.Add(s);
                        }
                        //Commands.Add(e);
                        ProceQueue.Add(e, CommandHelper.GetHandleByCommand(e.Command));
                    }
                }
            }
        }
Exemple #15
0
        public SaveLoadGui()
        {
            var cfg = GuiManager.Setttings.Sections["SaveLoad"];

            BaseTexture = new Texture(Utils.GetAsf(null, cfg["Image"]));
            Width       = BaseTexture.Width;
            Height      = BaseTexture.Height;
            Position    = new Vector2(
                (Globals.WindowWidth - Width) / 2f + int.Parse(cfg["LeftAdjust"]),
                (Globals.WindowHeight - Height) / 2f + int.Parse(cfg["TopAdjust"]));

            cfg = GuiManager.Setttings.Sections["SaveLoad_Text_List"];
            //Save load list
            var itemText = cfg["Text"].Split('/');

            _list = new ListTextItem(this,
                                     new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                     int.Parse(cfg["Width"]),
                                     int.Parse(cfg["Height"]),
                                     null,
                                     itemText.Length,
                                     itemText,
                                     int.Parse(cfg["CharSpace"]),
                                     int.Parse(cfg["LineSpace"]),
                                     int.Parse(cfg["ItemHeight"]),
                                     Utils.GetColor(cfg["Color"]),
                                     Utils.GetColor(cfg["SelectedColor"]),
                                     Utils.GetSoundEffect(cfg["Sound"]));

            //Save snapshot
            cfg           = GuiManager.Setttings.Sections["Save_Snapshot"];
            _saveSnapshot = new Bmp(this,
                                    new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                    "",
                                    int.Parse(cfg["Width"]),
                                    int.Parse(cfg["Height"]));

            //Buttons
            cfg = GuiManager.Setttings.Sections["SaveLoad_Load_Btn"];
            var asf          = Utils.GetAsf(null, cfg["Image"]);
            var clickedSound = Utils.GetSoundEffect(cfg["Sound"]);

            _loadButton = new GuiItem(this,
                                      new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                      int.Parse(cfg["Width"]),
                                      int.Parse(cfg["Height"]),
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      clickedSound);

            cfg          = GuiManager.Setttings.Sections["SaveLoad_Save_Btn"];
            asf          = Utils.GetAsf(null, cfg["Image"]);
            clickedSound = Utils.GetSoundEffect(cfg["Sound"]);
            _saveButton  = new GuiItem(this,
                                       new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                       int.Parse(cfg["Width"]),
                                       int.Parse(cfg["Height"]),
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       clickedSound);

            cfg          = GuiManager.Setttings.Sections["SaveLoad_Exit_Btn"];
            asf          = Utils.GetAsf(null, cfg["Image"]);
            clickedSound = Utils.GetSoundEffect(cfg["Sound"]);
            _exitButton  = new GuiItem(this,
                                       new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                       int.Parse(cfg["Width"]),
                                       int.Parse(cfg["Height"]),
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       clickedSound);

            //Save time
            cfg       = GuiManager.Setttings.Sections["SaveLoad_Save_Time_Text"];
            _saveTime = new TextGui(this,
                                    new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                    int.Parse(cfg["Width"]),
                                    int.Parse(cfg["Height"]),
                                    Globals.FontSize10,
                                    int.Parse(cfg["CharSpace"]),
                                    int.Parse(cfg["LineSpace"]),
                                    "",
                                    Utils.GetColor(cfg["Color"]));

            //Message
            cfg      = GuiManager.Setttings.Sections["SaveLoad_Message_Line_Text"];
            _message = new LineText(this,
                                    new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                    int.Parse(cfg["Width"]),
                                    int.Parse(cfg["Height"]),
                                    (LineText.Align) int.Parse(cfg["Align"]),
                                    string.Empty,
                                    Utils.GetColor(cfg["Color"]),
                                    Globals.FontSize12);

            RegisterEvent();

            SetSaveLoadIndex(Globals.SaveLoadSelectionIndex);

            IsShow = false;
        }
Exemple #16
0
        private static void ProtocolReaderLine()
        {
            if (LineText == "")
            {
                return;
            }
            if (LineText[0] == '$')
            {
                if (LineText.Length >= 2)
                {
                    if (LineText[1] == '$')
                    {
                        MMode2 = LineText.TrimStart('$');
                    }
                    else
                    {
                        MMode1 = LineText.TrimStart('$');
                    }
                }
                return;
            }
            if (LineText[0] == '@')
            {
                ClassDesc = LineText.TrimStart('@');
                return;
            }
            LineText.Trim();
            ProtocolReaderLineAnalyze();

            if (LineContect.Count <= 0)
            {
                return;
            }
            if (LineContect[0] == "enums")
            {
                BodyType    = EBodyType.eBodyTypeEnum;
                EnumCurrent = new CEnum(LineContect[1], ClassDesc);
                CEnumId     = 0;
            }
            else if (LineContect[0] == "enume")
            {
                DictEnum.Add(EnumCurrent.Name, EnumCurrent);
            }
            else if (LineContect[0] == "msgs")
            {
                BodyType = EBodyType.eBodyTypeClass;
                if (LineContect.Count > 2)
                {
                    ClassCurrent = new CClass(0, LineContect[1], ClassDesc, S2I(LineContect[2]));
                }
                else
                {
                    ClassCurrent = new CClass(0, LineContect[1], ClassDesc);
                }
            }
            else if (LineContect[0] == "msge")
            {
                DictClass.Add(ClassCurrent.Name, ClassCurrent);
            }
            else if (LineContect[0] == "pubs")
            {
                BodyType = EBodyType.eBodyTypeClass;
                if (LineContect.Count > 2)
                {
                    ClassCurrent = new CClass(1, LineContect[1], ClassDesc, S2I(LineContect[2]));
                }
                else
                {
                    ClassCurrent = new CClass(1, LineContect[1], ClassDesc);
                }
            }
            else if (LineContect[0] == "pube")
            {
                DictClass.Add(ClassCurrent.Name, ClassCurrent);
            }
            else
            {
                if (BodyType == EBodyType.eBodyTypeEnum)
                {
                    var node = new CEnum.Node()
                    {
                        Line = LineCount,
                        Body = LineContect[0],
                    };
                    if (LineContect.Count > 1)
                    {
                        CEnumId    = S2I(LineContect[1]);
                        node.Value = CEnumId;
                    }
                    else
                    {
                        CEnumId++;
                        node.Value = CEnumId;
                    }
                    node.Desc = LineDesc;
                    EnumCurrent.DictBody.Add(LineCount, node);
                }
                else if (BodyType == EBodyType.eBodyTypeClass)
                {
                    var node = new CClassNode();
                    GetNodeFromLine(ref node);
                    ClassCurrent.DictBody.Add(LineCount, node);
                }
            }
        }
Exemple #17
0
        private void LoadItems()
        {
            var sound = Utils.GetSoundEffect("界-浏览.wav");
            var asf   = Utils.GetAsf(@"asf\ui\littlemap\", "btnleft.asf");

            _leftButton = new GuiItem(this,
                                      new Vector2(437, 379),
                                      asf.Width,
                                      asf.Height,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);

            asf          = Utils.GetAsf(@"asf\ui\littlemap\", "btnright.asf");
            _rightButton = new GuiItem(this,
                                       new Vector2(464, 379),
                                       asf.Width,
                                       asf.Height,
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       sound);

            asf       = Utils.GetAsf(@"asf\ui\littlemap\", "btnup.asf");
            _upButton = new GuiItem(this,
                                    new Vector2(448, 368),
                                    asf.Width,
                                    asf.Height,
                                    new Texture(asf, 0, 1),
                                    null,
                                    new Texture(asf, 1, 1),
                                    null,
                                    sound);

            asf         = Utils.GetAsf(@"asf\ui\littlemap\", "btndown.asf");
            _downButton = new GuiItem(this,
                                      new Vector2(448, 395),
                                      asf.Width,
                                      asf.Height,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);

            asf          = Utils.GetAsf(@"asf\ui\littlemap\", "btnclose.asf");
            _closeButton = new GuiItem(this,
                                       new Vector2(448, 379),
                                       asf.Width,
                                       asf.Height,
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       sound);

            _mapName = new LineText(this,
                                    new Vector2(210, 92),
                                    220,
                                    30,
                                    LineText.Align.Center,
                                    string.Empty,
                                    new Color(76, 56, 48) * 0.8f,
                                    Globals.FontSize12);
            _bottomTip = new LineText(this,
                                      new Vector2(160, 370),
                                      260,
                                      30,
                                      LineText.Align.Left,
                                      "点击小地图进行移动",
                                      new Color(76, 56, 48) * 0.8f,
                                      Globals.FontSize10);
            _messageTip = new LineText(this,
                                       new Vector2(160, 370),
                                       260,
                                       30,
                                       LineText.Align.Right,
                                       "无法移动到目的地",
                                       new Color(200, 0, 0) * 0.8f,
                                       Globals.FontSize10);
            _messageTip.IsShow = false;
        }
	public void DisplayParagraph(RPGParagraph newParagraph)
	{
		//Debug.Log("display paragraph ");
		PlayerManager.Instance.Hero.questLog.CheckParagraph(activeConversation, activeConversation.conversationParagraphs.IndexOf(newParagraph));
		activeParagraph = newParagraph;
		affirmativeLinetext = null;
		negativeLinetext = null;
		for (int i = 0; i < activeParagraph.LineTexts.Count; i++) {
			if(activeParagraph.LineTexts[i].lineTextType == LineTextType.affirmative)
			{
				affirmativeLinetext = activeParagraph.LineTexts[i];
				Debug.Log(activeParagraph.LineTexts[i].CanYouDisplay());
				affirmativeButton.SetActive(activeParagraph.LineTexts[i].CanYouDisplay());
			}
			else if(activeParagraph.LineTexts[i].lineTextType == LineTextType.negative)
			{
				negativeLinetext = activeParagraph.LineTexts[i];
				negativeButton.SetActive(activeParagraph.LineTexts[i].CanYouDisplay());
			}
		}
		if(affirmativeLinetext == null)
			affirmativeButton.SetActive(false);
		else
		{
			affirmativeText.text = affirmativeLinetext.Text;
		}

		if(negativeLinetext == null)
		{
			negativeText.text = "Done";
		}
		else
		{
			negativeText.text = negativeLinetext.Text;
		}

		//negativeButton.SetActive(true);
		activeParagraph.DoEvents();
		if(!NeedsQuestInfo())
			HideQuestInfo();
		displaySpeakerJob = Job.make(DisplaySpeaker(newParagraph));
		if(activeParagraph.displayTimer > 0)
			displayParagraphTimerJob = Job.make(ParagraphTimeOut(activeParagraph.displayTimer));
		//StartCoroutine(DisplaySpeaker(newParagraph));
	}
Exemple #19
0
        public SaveLoadGui()
        {
            BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\saveload", "panel.asf"));
            Width       = BaseTexture.Width;
            Height      = BaseTexture.Height;
            Position    = new Vector2(
                (Globals.WindowWidth - Width) / 2f,
                (Globals.WindowHeight - Height) / 2f);

            //Save load list
            var itemText = new String[]
            {
                "进度一",
                "进度二",
                "进度三",
                "进度四",
                "进度五",
                "进度六",
                "进度七"
            };

            _list = new ListTextItem(this,
                                     new Vector2(135, 118),
                                     80,
                                     189,
                                     null,
                                     7,
                                     itemText,
                                     3,
                                     0,
                                     25,
                                     new Color(91, 31, 27) * 0.8f,
                                     new Color(102, 73, 212) * 0.8f,
                                     Utils.GetSoundEffect("界-浏览.wav"));

            //Save snapshot
            _saveSnapshot = new Bmp(this,
                                    new Vector2(256, 94),
                                    "",
                                    267,
                                    200);

            //Buttons
            var asf          = Utils.GetAsf(@"asf\ui\saveload", "btnLoad.asf");
            var clickedSound = Utils.GetSoundEffect("界-大按钮.wav");

            _loadButton = new GuiItem(this,
                                      new Vector2(248, 355),
                                      64,
                                      72,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      clickedSound);
            asf         = Utils.GetAsf(@"asf\ui\saveload", "btnSave.asf");
            _saveButton = new GuiItem(this,
                                      new Vector2(366, 355),
                                      64,
                                      72,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      clickedSound);
            asf         = Utils.GetAsf(@"asf\ui\saveload", "btnExit.asf");
            _exitButton = new GuiItem(this,
                                      new Vector2(464, 355),
                                      64,
                                      72,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      clickedSound);

            //Save time
            _saveTime = new TextGui(this,
                                    new Vector2(254, 310),
                                    350,
                                    30,
                                    Globals.FontSize10,
                                    1,
                                    0,
                                    "",
                                    new Color(182, 219, 189) * 0.7f);

            //Message
            _message = new LineText(this,
                                    new Vector2(0, 440),
                                    BaseTexture.Width,
                                    40,
                                    LineText.Align.Center,
                                    string.Empty,
                                    Color.Gold * 0.8f,
                                    Globals.FontSize12);

            RegisterEvent();

            SetSaveLoadIndex(Globals.SaveLoadSelectionIndex);

            IsShow = false;
        }
Exemple #20
0
        public static bool FLineFind(Board objBoard, LogBox objLogBox)
        {
            bool ret = false;

            LineText[] mpsLineText = new LineText[9];
            for (int s = 0; s <= 8; s++)
            {
                mpsLineText[s] = new LineText();
            }

            // Walk the board, concatenating all our Text strings into our array.
            foreach (Square sq in objBoard.rgSquare)
            {
                mpsLineText[sq.sector].row[sq.row % 3] += sq.btn.Text.Replace(" ", string.Empty);
                mpsLineText[sq.sector].col[sq.col % 3] += sq.btn.Text.Replace(" ", string.Empty);
            }

            // Within a sector, find a value that is present in just one row,
            // or just one column.

            for (int s = 0; s <= 8; s++)
            {
                for (char ch = '1'; ch <= '8'; ch++)
                {
                    if (
                        (mpsLineText[s].row[0].Contains(ch)) &&
                        (!mpsLineText[s].row[1].Contains(ch)) &&
                        (!mpsLineText[s].row[2].Contains(ch))
                        )
                    {
                        ret |= FRowLoser(objBoard, s, 0, ch, objLogBox);
                    }
                    if (
                        (!mpsLineText[s].row[0].Contains(ch)) &&
                        (mpsLineText[s].row[1].Contains(ch)) &&
                        (!mpsLineText[s].row[2].Contains(ch))
                        )
                    {
                        ret |= FRowLoser(objBoard, s, 1, ch, objLogBox);
                    }
                    if (
                        (!mpsLineText[s].row[0].Contains(ch)) &&
                        (!mpsLineText[s].row[1].Contains(ch)) &&
                        (mpsLineText[s].row[2].Contains(ch))
                        )
                    {
                        ret |= FRowLoser(objBoard, s, 2, ch, objLogBox);
                    }

                    if (
                        (mpsLineText[s].col[0].Contains(ch)) &&
                        (!mpsLineText[s].col[1].Contains(ch)) &&
                        (!mpsLineText[s].col[2].Contains(ch))
                        )
                    {
                        ret |= FColLoser(objBoard, s, 0, ch, objLogBox);
                    }
                    if (
                        (!mpsLineText[s].col[0].Contains(ch)) &&
                        (mpsLineText[s].col[1].Contains(ch)) &&
                        (!mpsLineText[s].col[2].Contains(ch))
                        )
                    {
                        ret |= FColLoser(objBoard, s, 1, ch, objLogBox);
                    }
                    if (
                        (!mpsLineText[s].col[0].Contains(ch)) &&
                        (!mpsLineText[s].col[1].Contains(ch)) &&
                        (mpsLineText[s].col[2].Contains(ch))
                        )
                    {
                        ret |= FColLoser(objBoard, s, 2, ch, objLogBox);
                    }
                }
            }
            return(ret);
        }
	/*public void AddGeneralConversation(RPGNPC npc)
	{
		if (npc.GeneralConversationID == null || npc.GeneralConversationID.Count == 0)
			return;
		
		if (ParentLineTextId != 0)
			return;
		
		if (paragraphs == null)
		{
			paragraphs = Storage.Load<RPGParagraph>(new RPGParagraph());
		}
		
		foreach(int ID in npc.GeneralConversationID)
		{
			foreach(RPGParagraph p in paragraphs)
			{
				if (p.ID == ID)
				{
					this.ID = p.ID;
					
					if (string.IsNullOrEmpty(ParagraphText))
						ParagraphText = p.ParagraphText;
					
					foreach(LineText lt in p.LineTexts)
					{
						LineTexts.Add(lt);
					}
				}
			}
		}
	}*/
	
	public void AddLineText()
	{
		if (QuestID == 0)
			return;
		
		//List<RPGParagraph> paragraphs = Storage.Load<RPGParagraph>(this);
		
		LineText lineText;
		Condition c;
		
		int newLineTextId =  0;
		
		lineText = new LineText();
		lineText.ID = newLineTextId;
		lineText.Text = "Quest number " + QuestID + " is not started";
		c = new Condition();
		c.ItemToHave = QuestID.ToString();
		c.ConditionType = ConditionTypeEnum.QuestNotStarted;
		
		lineText.Conditions.Add(c);
		LineTexts.Add(lineText);
		
		newLineTextId++;
		
		lineText = new LineText();
		lineText.ID = newLineTextId;
		lineText.Text = "Quest number " + QuestID + " in progress";
		c = new Condition();
		c.ItemToHave = QuestID.ToString();
		c.ConditionType = ConditionTypeEnum.QuestInProgress;
		
		lineText.Conditions.Add(c);
		LineTexts.Add(lineText);
		
		newLineTextId++;
		
		
		lineText = new LineText();
		lineText.ID = newLineTextId;
		lineText.Text = "Quest number " + QuestID + " in finished";
		c = new Condition();
		c.ItemToHave = QuestID.ToString();
		c.ConditionType = ConditionTypeEnum.QuestFinished;
		
		lineText.Conditions.Add(c);
		LineTexts.Add(lineText);
		
		newLineTextId++;
		
		lineText = new LineText();
		lineText.ID = newLineTextId;
		lineText.Text = "Quest number " + QuestID + " is completed";
		c = new Condition();
		c.ItemToHave = QuestID.ToString();
		c.ConditionType = ConditionTypeEnum.QuestCompleted;
		
		lineText.Conditions.Add(c);
		LineTexts.Add(lineText);
		
		QuestID = 0;
	}
	public void AddLinetext(LineText s, int j)
	{
		EditorUtils.Label("Player reply: " + j);
		EditorGUILayout.BeginHorizontal();
		EditorGUILayout.PrefixLabel("reply text");
		s.Text = EditorGUILayout.TextArea(s.Text, GUILayout.Width(700));
		s.lineTextType = (LineTextType)EditorGUILayout.EnumPopup(s.lineTextType, GUILayout.Width(150));
		EditorGUILayout.EndHorizontal();
		GUIUtils.ConditionsEvents(s.Conditions, s.Events, Data);
	}
Exemple #23
0
        private void LoadItems()
        {
            var cfg   = GuiManager.Setttings.Sections["LittleMap_Left_Btn"];
            var sound = Utils.GetSoundEffect(cfg["Sound"]);
            var asf   = Utils.GetAsf(null, cfg["Image"]);

            _leftButton = new GuiItem(this,
                                      new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                      asf.Width,
                                      asf.Height,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);

            cfg          = GuiManager.Setttings.Sections["LittleMap_Right_Btn"];
            asf          = Utils.GetAsf(null, cfg["Image"]);
            sound        = Utils.GetSoundEffect(cfg["Sound"]);
            _rightButton = new GuiItem(this,
                                       new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                       asf.Width,
                                       asf.Height,
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       sound);

            cfg       = GuiManager.Setttings.Sections["LittleMap_Up_Btn"];
            asf       = Utils.GetAsf(null, cfg["Image"]);
            sound     = Utils.GetSoundEffect(cfg["Sound"]);
            _upButton = new GuiItem(this,
                                    new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                    asf.Width,
                                    asf.Height,
                                    new Texture(asf, 0, 1),
                                    null,
                                    new Texture(asf, 1, 1),
                                    null,
                                    sound);

            cfg         = GuiManager.Setttings.Sections["LittleMap_Down_Btn"];
            asf         = Utils.GetAsf(null, cfg["Image"]);
            sound       = Utils.GetSoundEffect(cfg["Sound"]);
            _downButton = new GuiItem(this,
                                      new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                      asf.Width,
                                      asf.Height,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);

            cfg          = GuiManager.Setttings.Sections["LittleMap_Close_Btn"];
            asf          = Utils.GetAsf(null, cfg["Image"]);
            sound        = Utils.GetSoundEffect(cfg["Sound"]);
            _closeButton = new GuiItem(this,
                                       new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                       asf.Width,
                                       asf.Height,
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       sound);

            cfg      = GuiManager.Setttings.Sections["LittleMap_Map_Name_Line_Text"];
            _mapName = new LineText(this,
                                    new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                    int.Parse(cfg["Width"]),
                                    int.Parse(cfg["Height"]),
                                    (LineText.Align) int.Parse(cfg["Align"]),
                                    string.Empty,
                                    Utils.GetColor(cfg["Color"]),
                                    Globals.FontSize12);

            cfg        = GuiManager.Setttings.Sections["LittleMap_Bottom_Tip_Line_Text"];
            _bottomTip = new LineText(this,
                                      new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                      int.Parse(cfg["Width"]),
                                      int.Parse(cfg["Height"]),
                                      (LineText.Align) int.Parse(cfg["Align"]),
                                      "点击小地图进行移动",
                                      Utils.GetColor(cfg["Color"]),
                                      Globals.FontSize10);

            cfg         = GuiManager.Setttings.Sections["LittleMap_Message_Tip_Line_Text"];
            _messageTip = new LineText(this,
                                       new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                       int.Parse(cfg["Width"]),
                                       int.Parse(cfg["Height"]),
                                       (LineText.Align) int.Parse(cfg["Align"]),
                                       "无法移动到目的地",
                                       Utils.GetColor(cfg["Color"]),
                                       Globals.FontSize10);
            _messageTip.IsShow = false;
        }
	public void AddParagraph(RPGParagraph s, int j)
	{
		EditorUtils.Label("paragraph id: "+j);
		EditorGUILayout.BeginHorizontal();
		EditorGUILayout.PrefixLabel("base paragraph?");
		s.isBaseParagraph = EditorGUILayout.Toggle(s.isBaseParagraph, GUILayout.Width(50));
		EditorGUILayout.PrefixLabel("Display timer");
		s.displayTimer = EditorGUILayout.FloatField(s.displayTimer, GUILayout.Width(100));
		EditorGUILayout.PrefixLabel("owner NPC");
		s.ownerNPCID = EditorUtils.IntPopup(s.ownerNPCID, Data.npcEditor.items, FieldTypeEnum.Middle);
		EditorGUILayout.EndHorizontal();
		EditorGUILayout.BeginHorizontal();
		EditorGUILayout.PrefixLabel("NPC text");
		s.ParagraphText = EditorGUILayout.TextArea(s.ParagraphText, GUILayout.Width(700));
		EditorGUILayout.EndHorizontal();
		EditorGUILayout.BeginHorizontal();
		EditorGUILayout.PrefixLabel("Next Paragraph Interaction");
		s.nextParagraphCondition = (NextParagraphInteraction)EditorGUILayout.EnumPopup(s.nextParagraphCondition, GUILayout.Width(300));
		EditorGUILayout.EndHorizontal();
		for (int i = 0; i < s.nextParagraphIDs.Count; i++) {
			EditorGUILayout.BeginHorizontal();
			s.nextParagraphIDs[i] = EditorGUILayout.IntField( s.nextParagraphIDs[i], GUILayout.Width(100));
			if(GUILayout.Button("Remove", GUILayout.Width(200)))
			{
				s.nextParagraphIDs.Remove(s.nextParagraphIDs[i]);
				break;
			}
			EditorGUILayout.EndHorizontal();
		}
		
		if(GUILayout.Button("Add Next Paragraph ID", GUILayout.Width(300)))
		{
			s.nextParagraphIDs.Add(1);
		}
		GUIUtils.ConditionsEvents(s.Conditions, s.Actions, Data);

		for (int i = 0; i < s.LineTexts.Count; i++) {
			EditorGUILayout.BeginVertical(skin.box);
			AddLinetext(s.LineTexts[i], i);
			if (GUILayout.Button("Delete Player Reply" + i, GUILayout.Width(200)))
			{
				s.LineTexts.Remove(s.LineTexts[i]);
				break;
			}
			EditorGUILayout.EndVertical();
		}
		if (GUILayout.Button("Add Player Reply", GUILayout.Width(200)))
		{
			LineText p = new LineText();
			s.LineTexts.Add(p);
		}
	}
Exemple #25
0
 public int Length()
 {
     return(LineText.Count(x => x == x12File.elementDelimiter));
 }