public SelectableText SelectOptionProp(string selfValueHeaderDictText)
        {
            self.value       = selfValueHeaderDictText;
            selList.elemNum += 1;

            float         loc        = selList.loc - 1f / (1f + selList.elemNum);
            UITextPhrase  textHead   = new UITextPhrase(loc, self.value);
            List <string> newEntries = opdict[self.value].ToList();

            newEntries.Add(OptionsDict.SelectableList.removeTag);
            SelectableText selTex = new SelectableText(textHead, infoPanel, selList, self.value, newEntries, false);

            uilist.Add(textHead);
            thisAsSel        = new Selectable(selTex);
            selTex.thisAsSel = thisAsSel;

            infoPanel.selectables.Add(thisAsSel);
            targetUIdesc.ClearCurrent();

            if (newEntries.Count > 1)
            {
                if (selList.which.Equals(OptionsDict.Phase2.positive) || selList.which.Equals(OptionsDict.Phase3.positive))
                {
                    thisAsSel.SetValue(newEntries[1]);
                }
                else if (selList.which.Equals(OptionsDict.Phase2.negative) || selList.which.Equals(OptionsDict.Phase3.negative))
                {
                    thisAsSel.SetValue(newEntries[Math.Max(0, (newEntries.Count - 1) * 3 / 4 - 1)]);
                }
            }


            return(selTex);
        }
        public SelectableText(UITextPhrase self, InfoPanel infoPanel, SelectableList selList, string header, List <string> properties, bool isOption = true)
        {
            this.opdict    = infoPanel.opdict;
            this.uilist    = infoPanel.uielem;
            this.selList   = selList;
            this.infoPanel = infoPanel;
            target         = header;
            values         = properties != null?properties.ToList() : new List <string>();

            if (values.Count > 1 || (values.Count == 1 && values[0].Equals(OptionsDict.SelectableList.removeTag)))
            {
                values.Insert(0, "# " + header);
            }
            this.self         = self;
            this.targetUIdesc = infoPanel.uidesc;
            if (properties != null && properties.Count > 0)
            {
                if (isOption)
                {
                    self.OnClick += SelectOption;
                }
                else
                {
                    self.OnClick += select;
                }

                self.OnMouseOver += ChangeToGrey;
                self.OnMouseOut  += ChangeToWhite;
            }
        }
        public SelectableText AddSelectable(string header, List <string> properties)
        {
            UITextPhrase   textHead = new UITextPhrase(uielem.Count + 1, header);
            SelectableText newSel   = new SelectableText(textHead, uidesc, opdict, header, properties);

            selectables.Add(new Selectable(newSel));
            uielem.Add(textHead);
            return(newSel);
        }
 public SelectableText(UITextPhrase self, UIListDescription targetUIdesc, OptionsDict opdict, string header, string[] properties)
 {
     values = new List <string>();
     for (int i = 0; i < properties.Length; i++)
     {
         values.Add(properties[i]);
     }
     Create(self, targetUIdesc, opdict, header, values);
 }
 public SelectableText(UITextPhrase self, UIListDescription targetUIdesc, OptionsDict opdict, string header, string properties = "")
 {
     values = new List <string>();
     if (!properties.Equals(""))
     {
         values.Add(properties);
     }
     Create(self, targetUIdesc, opdict, header, values);
 }
        public override int CompareTo(object obj)
        {
            UISortInputText otherIsP = obj as UISortInputText;
            UITextPhrase    otherIsT = obj as UITextPhrase;

            if (otherIsP == null)
            {
                return(ind.CompareTo(otherIsT.ind));
            }
            else
            {
                return(ind.CompareTo(otherIsP.ind));
            }
        }
        private void Create(UITextPhrase self, UIListDescription targetUIdesc, OptionsDict opdict, string header, List <string> properties)
        {
            this.opdict = opdict;
            target      = header;
            values      = properties != null?properties.ToList() : new List <string>();

            if (values.Count > 1)
            {
                values.Insert(0, "# " + header);
            }
            this.self         = self;
            this.targetUIdesc = targetUIdesc;
            if (properties != null && properties.Count > 0)
            {
                self.OnClick     += select;
                self.OnMouseOver += ChangeToGrey;
                self.OnMouseOut  += ChangeToWhite;
            }
        }
        public SelectableText AddSelectable(string header, int from, int steps, int stepSize = 1, int factor1 = 1, int factor2 = 0)
        {
            UITextPhrase  textHead = new UITextPhrase(uielem.Count + 1, header);
            List <string> values   = new List <string>();
            int           n        = from;
            int           cfactor  = 0;
            int           factor   = 1;

            for (int i = 0; i < steps; i++)
            {
                cfactor = cfactor == factor1 && factor2 != 0 ? factor2 : factor1;
                factor *= cfactor;
                n       = (from + i * stepSize) * factor;
                values.Add(n.ToString());
            }
            SelectableText newSel = new SelectableText(textHead, uidesc, opdict, header, values);

            selectables.Add(new Selectable(newSel));
            uielem.Add(textHead);
            return(newSel);
        }
        public SelectableText AddSelectableList(SelectableList selList, char kind)
        {
            SelectableText selt;

            switch (kind)
            {
            case listKindPositive:
                (selt = this.AddSelectable(OptionsDict.SelectableList.positive, OptionsDict.SelectableList.positiveDescription)).setCustomColor(Color.LightGreen); break;

            case listKindNegative:
                (selt = this.AddSelectable(OptionsDict.SelectableList.negative, OptionsDict.SelectableList.negativeDescription)).setCustomColor(Color.PaleVioletRed); break;

            case listKindNaming:
                (selt = this.AddSelectable(OptionsDict.SelectableList.name, OptionsDict.SelectableList.nameDescription)).setCustomColor(Color.LightGoldenrodYellow); break;

            case listKindOmitRare:
                (selt = this.AddSelectable(OptionsDict.SelectableList.omitRare, OptionsDict.SelectableList.omitRareDescription)).setCustomColor(Color.LightGoldenrodYellow); break;

            default:
                selt = this.AddSelectable("?VVVVVVV select VVVVVVV?", "here you can add what?"); break;
            }


            UITextPhrase textHead = new UITextPhrase(uielem.Count + 1, OptionsDict.SelectableList.addingTag);

            selList.elemNum = 0;
            selList.loc     = uielem.Count + 1;
            //SelectableText newSel = new SelectableText(textHead, uidesc, uielem, selList, opdict, "Add", opdict[selList.which]);sdfd
            SelectableText newSel = new SelectableText(textHead, this, selList, OptionsDict.SelectableList.addingTag, opdict[selList.which]);

            newSel.SetValue(selList.which);

            uielem.Add(textHead);
            newSel.setCustomColor(Color.SlateGray);
            //SelectableText bo = this.AddSelectable("'''''''''''''''''''''''''''''''''''''''''''''''''''''", new List<string>{});
            //if (isPositive) bo.setCustomColor(Color.LightGreen); else bo.setCustomColor(Color.PaleVioletRed);
            return(newSel);
        }
Esempio n. 10
0
        public void AddText(string text, bool isReshape = false, bool isList = false)
        {
            isUpdating = true;

            String[] lines = text.Split('\n');
            maxSize = 0;


            for (int lineInd = 0; lineInd < lines.Length; lineInd++)
            {
                String[] substrings = lines[lineInd].Split(' ');

                string line     = "";
                string lastline = "";


                Texture2D icon = null;
                bool      thisLineStartsWithIcon = false;
                int       iconwith = 0;



                for (int stringInd = 0; stringInd < substrings.Length; stringInd++)
                {
                    line += (line.Equals("") ? "" : " ") + substrings[stringInd];



                    if (uiss != null && line.Length > 0 && line[0] == '@' && uiss.iconDict.ContainsKey(line))
                    {
                        icon = uiss.iconDict[line];
                        line = "";
                        thisLineStartsWithIcon = true;
                        iconwith = icon.Width;
                    }
                    else if (!thisLineStartsWithIcon)
                    {
                        icon     = null;
                        iconwith = 0;
                    }

                    UITextPhrase entry = new UITextPhrase(lastInd, line, icon);
                    entry.uitext.HAlign = 0;


                    entry.uitext.SetText(line);
                    float wi = (entry.uitext.GetDimensions()).Width + iconwith;
                    maxSize = Math.Max(maxSize, wi);
                    if (wi > alignWidth && !isList)
                    {
                        if (lastline.Equals(""))
                        {
                            lastline = line; //todo
                        }

                        entry.uitext.SetText(lastline);
                        thisLineStartsWithIcon = false;
                        iconwith     = 0;
                        entry.HAlign = 0.5f;
                        this.Add(entry);
                        entryList.Add(entry);
                        line = substrings[stringInd];

                        lastline = "";
                        lastInd++;
                    }
                    else
                    {
                        lastline = line;
                    }
                }
                if (!line.Equals("") || ((lines[lineInd].Equals("") || lines[lineInd].Equals(" ")) && lineInd != 0))
                {
                    UITextPhrase entry = new UITextPhrase(lastInd++, line, icon);

                    this.Add(entry);
                    entryList.Add(entry);
                }
            }


            if (!isReshape)
            {
                fulltext += "\n" + text;
            }



            isUpdating = false;;
        }
 public SelectableText(UITextPhrase self, UIListDescription targetUIdesc, OptionsDict opdict, string header, List <string> properties)
 {
     values = properties;
     Create(self, targetUIdesc, opdict, header, values);
 }