/**
     * Create my own info box
     */
    void CreateMyPlayerInfoBox(Player pPlayer)
    {
        GameObject playerInfo = (GameObject)Instantiate(mMyPlayerInfoPrefab, Vector3.zero, Quaternion.identity);

        playerInfo.transform.parent = mPlayersList.gameObject.transform;

        dfTextbox myNameTextBox = (dfTextbox)playerInfo.GetComponentInChildren(typeof(dfTextbox));

        myNameTextBox.Text = pPlayer.uName;
        dfPropertyBinding.Bind(myNameTextBox.gameObject, myNameTextBox, "Text", pPlayer, "uName");

        dfDropdown myStation = (dfDropdown)playerInfo.GetComponentInChildren(typeof(dfDropdown));

        dfEventDrivenPropertyBinding.Bind(myStation.gameObject, pPlayer, "uAvailableStationNames", "AvailableStationsHaveChanged", myStation, "Items", null);

        dfPropertyBinding.Bind(myStation.gameObject, myStation, "SelectedIndex", pPlayer, "uSelectedStationIndex");

        dfTextureSprite stationLogo = playerInfo.transform.FindChild("StationLogo").GetComponent <dfTextureSprite>();

        dfPropertyBinding.Bind(stationLogo.gameObject, pPlayer, "uStationLogo", stationLogo, "Texture");

        dfTextureSprite d = playerInfo.transform.FindChild("IsPlayerReady").GetComponent <dfTextureSprite>();

        dfPropertyBinding.Bind(d.gameObject, pPlayer, "uReadyTexture", d, "Texture");
    }
    void Awake()
    {
        mPanel = gameObject.GetComponent<dfPanel>();
        mLabel = gameObject.GetComponentInChildren<dfLabel>();
        mTextBox = gameObject.GetComponentInChildren<dfTextbox>();
        mPanel.enabled = false;

        DontDestroyOnLoad (gameObject);
    }
    void Awake()
    {
        mPanel         = gameObject.GetComponent <dfPanel>();
        mLabel         = gameObject.GetComponentInChildren <dfLabel>();
        mTextBox       = gameObject.GetComponentInChildren <dfTextbox>();
        mPanel.enabled = false;

        DontDestroyOnLoad(gameObject);
    }
Esempio n. 4
0
    public void OnEnable()
    {
        this._textbox = GetComponent <dfTextbox>();

        if (string.IsNullOrEmpty(_textbox.Text) || _textbox.Text == promptText)
        {
            _textbox.Text      = promptText;
            _textbox.TextColor = promptColor;
        }
    }
Esempio n. 5
0
    public void OnEnable()
    {
        this._textbox = GetComponent<dfTextbox>();

        if( string.IsNullOrEmpty( _textbox.Text ) || _textbox.Text == promptText )
        {
            _textbox.Text = promptText;
            _textbox.TextColor = promptColor;
        }
    }
Esempio n. 6
0
 public static ISubscription bind <T>(
     this IRxRef <T> subject, dfTextbox control,
     Fn <T, string> mapper, Fn <string, T> comapper
     )
 {
     return(subject.bind(
                mapper, comapper,
                text => control.Text = text,
                handler => control.TextChanged += handler,
                handler => control.TextChanged -= handler
                ));
 }
Esempio n. 7
0
    public void OnTextChanged(dfTextbox control, string value)
    {
        int           cursorIndex   = control.CursorIndex;
        StringBuilder stringBuilder = new StringBuilder();

        for (int i = 0; i < value.Length; i++)
        {
            if (char.IsDigit(value[i]))
            {
                stringBuilder.Append(value[i]);
            }
        }
        control.Text = stringBuilder.ToString();
    }
Esempio n. 8
0
 private void selectWordAtIndex(int index)
 {
     if (string.IsNullOrEmpty(this.text))
     {
         return;
     }
     index = Mathf.Max(Mathf.Min(this.text.Length - 1, index), 0);
     if (char.IsLetterOrDigit(this.text[index]))
     {
         this.selectionStart = index;
         int num = index;
         while (num > 0)
         {
             if (!char.IsLetterOrDigit(this.text[num - 1]))
             {
                 break;
             }
             else
             {
                 dfTextbox _dfTextbox = this;
                 _dfTextbox.selectionStart = _dfTextbox.selectionStart - 1;
                 num--;
             }
         }
         this.selectionEnd = index;
         int num1 = index;
         while (num1 < this.text.Length)
         {
             if (!char.IsLetterOrDigit(this.text[num1]))
             {
                 break;
             }
             else
             {
                 this.selectionEnd = num1 + 1;
                 num1++;
             }
         }
     }
     else
     {
         this.selectionStart       = index;
         this.selectionEnd         = index + 1;
         this.mouseSelectionAnchor = 0;
     }
     this.cursorIndex = this.selectionStart;
     this.Invalidate();
 }
    public void OnSave()
    {
        dfTextbox saveText = GameObject.Find("NameTextbox").GetComponent <dfTextbox> ();

        if (saveText.Text == "")
        {
            print("no planet name!");
        }
        else
        {
            mp.planetInfo.planetName = saveText.Text;
            print("about to save");
            mp.Save();
            print("saved");
            Notification.Instance.SetNotification("Planet Saved");
            print("notification set");
        }
    }
Esempio n. 10
0
    public void OnTextChanged(dfTextbox control, string value)
    {
        int           cursorIndex = control.CursorIndex;
        StringBuilder builder     = new StringBuilder();

        for (int i = 0; i < value.Length; i++)
        {
            if (this.allowedChars.IndexOf(value[i]) != -1)
            {
                builder.Append(value[i]);
            }
            else
            {
                cursorIndex = Mathf.Max(0, cursorIndex + 1);
            }
        }
        control.Text        = builder.ToString();
        control.CursorIndex = cursorIndex;
    }
    void Start()
    {
        if (Utility.IsWeb())
        {
            dfButton saveButton = GameObject.Find("SaveButton").GetComponent <dfButton> ();
            saveButton.Hide();
            dfTextbox saveText = GameObject.Find("NameTextbox").GetComponent <dfTextbox> ();
            saveText.Hide();
        }

        planet = GameObject.Find("Planet");
        mp     = planet.GetComponent <Planet> ();

        skyboxes = Utility.GetSkyboxes();
        dfDropdown skyboxDropdown = GameObject.Find("SkyBoxDropdown").GetComponent <dfDropdown> ();

        skyboxDropdown.Items         = skyboxes;
        skyboxDropdown.SelectedIndex = 0;

        planetNormals = Utility.GetPlanetNormals();
        dfDropdown normalDropdown = GameObject.Find("NormalDropdown").GetComponent <dfDropdown> ();

        normalDropdown.Items         = planetNormals;
        normalDropdown.SelectedIndex = 0;

        dfDropdown loadDropdown = GameObject.Find("LoadDropdown").GetComponent <dfDropdown> ();

        if (!Utility.IsWeb())
        {
            userPlanets        = Utility.GetAllFilesInFolder("config", "userplanet");
            loadDropdown.Items = userPlanets;
        }
        else
        {
            loadDropdown.Hide();
        }

        RedrawPlanet();
    }
Esempio n. 12
0
    private void deletePreviousChar()
    {
        if (this.selectionStart != this.selectionEnd)
        {
            int num = this.selectionStart;
            this.deleteSelection();
            this.setCursorPos(num);
            return;
        }
        this.ClearSelection();
        if (this.cursorIndex == 0)
        {
            return;
        }
        this.text = this.text.Remove(this.cursorIndex - 1, 1);
        dfTextbox _dfTextbox = this;

        _dfTextbox.cursorIndex = _dfTextbox.cursorIndex - 1;
        this.cursorShown       = true;
        this.OnTextChanged();
        this.Invalidate();
    }
Esempio n. 13
0
 private void moveSelectionPointRight()
 {
     if (this.cursorIndex == this.text.Length)
     {
         return;
     }
     if (this.selectionEnd == this.selectionStart)
     {
         this.selectionEnd   = this.cursorIndex + 1;
         this.selectionStart = this.cursorIndex;
     }
     else if (this.selectionEnd == this.cursorIndex)
     {
         dfTextbox _dfTextbox = this;
         _dfTextbox.selectionEnd = _dfTextbox.selectionEnd + 1;
     }
     else if (this.selectionStart == this.cursorIndex)
     {
         dfTextbox _dfTextbox1 = this;
         _dfTextbox1.selectionStart = _dfTextbox1.selectionStart + 1;
     }
     this.setCursorPos(this.cursorIndex + 1);
 }
Esempio n. 14
0
 private void moveSelectionPointLeft()
 {
     if (this.cursorIndex == 0)
     {
         return;
     }
     if (this.selectionEnd == this.selectionStart)
     {
         this.selectionEnd   = this.cursorIndex;
         this.selectionStart = this.cursorIndex - 1;
     }
     else if (this.selectionEnd == this.cursorIndex)
     {
         dfTextbox _dfTextbox = this;
         _dfTextbox.selectionEnd = _dfTextbox.selectionEnd - 1;
     }
     else if (this.selectionStart == this.cursorIndex)
     {
         dfTextbox _dfTextbox1 = this;
         _dfTextbox1.selectionStart = _dfTextbox1.selectionStart - 1;
     }
     this.setCursorPos(this.cursorIndex - 1);
 }
Esempio n. 15
0
        internal static IEnumerator CreateMenuEntryTextboxCoroutine(dfControl panel, dfControl parent, string text, bool localize = false)
        {
            Console.WriteLine($"XXXENTRY");

            var inner_panel = panel.transform.GetChild(0);

            var label = inner_panel.GetChild(0).gameObject.GetComponent <dfLabel>();

            label.IsLocalized = localize;
            label.Text        = text;

            UnityEngine.Object.Destroy(inner_panel.GetChild(1)?.gameObject);
            UnityEngine.Object.Destroy(inner_panel.GetChild(2)?.gameObject);
            UnityEngine.Object.Destroy(inner_panel.GetChild(3)?.gameObject);

            Console.WriteLine($"XXXDESTROYED");

            yield return(null);

            Console.WriteLine($"XXXNEXTFRAME");

            var textbox = inner_panel.gameObject.GetComponent <dfPanel>().AddControl <dfTextbox>();

            textbox.Font      = GungeonFont;
            textbox.Color     = Color.white;
            textbox.Width     = 200;
            textbox.IsVisible = true;
            textbox.Height    = 50;
            TestTest          = textbox;

            var menu_item = panel.GetComponent <BraveOptionsMenuItem>();

            menu_item.itemType             = (BraveOptionsMenuItem.BraveOptionsMenuItemType)Patches.BraveOptionsMenuItem.BraveOptionsMenuItemTypeExtended.SemiTextbox;
            menu_item.optionType           = BraveOptionsMenuItem.BraveOptionsOptionType.NONE;
            menu_item.selectedLabelControl = null;
            ((Patches.BraveOptionsMenuItem)menu_item).textboxControl = textbox;
        }
Esempio n. 16
0
    private void pasteAtCursor(string clipData)
    {
        this.deleteSelection();
        StringBuilder stringBuilder = new StringBuilder(this.text.Length + clipData.Length);

        stringBuilder.Append(this.text);
        for (int i = 0; i < clipData.Length; i++)
        {
            char chr = clipData[i];
            if (chr >= ' ')
            {
                dfTextbox _dfTextbox = this;
                int       num        = _dfTextbox.cursorIndex;
                int       num1       = num;
                _dfTextbox.cursorIndex = num + 1;
                stringBuilder.Insert(num1, chr);
            }
        }
        stringBuilder.Length = Mathf.Min(stringBuilder.Length, this.maxLength);
        this.text            = stringBuilder.ToString();
        this.setCursorPos(this.cursorIndex);
        this.OnTextChanged();
        this.Invalidate();
    }
Esempio n. 17
0
 private void processKeyPress(dfKeyEventArgs args)
 {
     this.deleteSelection();
     if (this.text.Length < this.MaxLength)
     {
         if (this.cursorIndex != this.text.Length)
         {
             string str       = this.text;
             int    num       = this.cursorIndex;
             char   character = args.Character;
             this.text = str.Insert(num, character.ToString());
         }
         else
         {
             dfTextbox _dfTextbox = this;
             _dfTextbox.text = string.Concat(_dfTextbox.text, args.Character);
         }
         dfTextbox _dfTextbox1 = this;
         _dfTextbox1.cursorIndex = _dfTextbox1.cursorIndex + 1;
         this.OnTextChanged();
         this.Invalidate();
     }
     args.Use();
 }
Esempio n. 18
0
    private void renderText(dfRenderData textBuffer)
    {
        int     num;
        float   units               = base.PixelsToUnits();
        Vector2 vector2             = new Vector2(this.size.x - (float)this.padding.horizontal, this.size.y - (float)this.padding.vertical);
        Vector3 upperLeft           = this.pivot.TransformToUpperLeft(base.Size);
        Vector3 vector3             = new Vector3(upperLeft.x + (float)this.padding.left, upperLeft.y - (float)this.padding.top, 0f) * units;
        string  str                 = (!this.IsPasswordField || string.IsNullOrEmpty(this.passwordChar) ? this.text : this.passwordDisplayText());
        Color32 color32             = (!base.IsEnabled ? base.DisabledColor : this.TextColor);
        float   textScaleMultiplier = this.getTextScaleMultiplier();

        using (dfFontRendererBase textScale = this.font.ObtainRenderer())
        {
            textScale.WordWrap             = false;
            textScale.MaxSize              = vector2;
            textScale.PixelRatio           = units;
            textScale.TextScale            = this.TextScale * textScaleMultiplier;
            textScale.VectorOffset         = vector3;
            textScale.MultiLine            = false;
            textScale.TextAlign            = UnityEngine.TextAlignment.Left;
            textScale.ProcessMarkup        = false;
            textScale.DefaultColor         = color32;
            textScale.BottomColor          = new Color32?(color32);
            textScale.OverrideMarkupColors = false;
            textScale.Opacity              = base.CalculateOpacity();
            textScale.Shadow       = this.Shadow;
            textScale.ShadowColor  = this.ShadowColor;
            textScale.ShadowOffset = this.ShadowOffset;
            this.cursorIndex       = Mathf.Min(this.cursorIndex, str.Length);
            this.scrollIndex       = Mathf.Min(Mathf.Min(this.scrollIndex, this.cursorIndex), str.Length);
            this.charWidths        = textScale.GetCharacterWidths(str);
            Vector2 vector21 = vector2 * units;
            this.leftOffset = 0f;
            if (this.textAlign != UnityEngine.TextAlignment.Left)
            {
                this.scrollIndex = Mathf.Max(0, Mathf.Min(this.cursorIndex, str.Length - 1));
                float single   = 0f;
                float fontSize = (float)this.font.FontSize * 1.25f * units;
                while (this.scrollIndex > 0 && single < vector21.x - fontSize)
                {
                    float[]   singleArray = this.charWidths;
                    dfTextbox _dfTextbox  = this;
                    int       num1        = _dfTextbox.scrollIndex;
                    num = num1;
                    _dfTextbox.scrollIndex = num1 - 1;
                    single = single + singleArray[num];
                }
                float single1 = (str.Length <= 0 ? 0f : textScale.GetCharacterWidths(str.Substring(this.scrollIndex)).Sum());
                UnityEngine.TextAlignment textAlignment = this.textAlign;
                if (textAlignment == UnityEngine.TextAlignment.Center)
                {
                    this.leftOffset = Mathf.Max(0f, (vector21.x - single1) * 0.5f);
                }
                else if (textAlignment == UnityEngine.TextAlignment.Right)
                {
                    this.leftOffset = Mathf.Max(0f, vector21.x - single1);
                }
                vector3.x = vector3.x + this.leftOffset;
                textScale.VectorOffset = vector3;
            }
            else
            {
                float single2 = 0f;
                for (int i = this.scrollIndex; i < this.cursorIndex; i++)
                {
                    single2 = single2 + this.charWidths[i];
                }
                while (single2 >= vector21.x && this.scrollIndex < this.cursorIndex)
                {
                    float[]   singleArray1 = this.charWidths;
                    dfTextbox _dfTextbox1  = this;
                    int       num2         = _dfTextbox1.scrollIndex;
                    num = num2;
                    _dfTextbox1.scrollIndex = num2 + 1;
                    single2 = single2 - singleArray1[num];
                }
            }
            if (this.selectionEnd != this.selectionStart)
            {
                this.renderSelection(this.scrollIndex, this.charWidths, this.leftOffset);
            }
            else if (this.cursorShown)
            {
                this.renderCursor(this.scrollIndex, this.cursorIndex, this.charWidths, this.leftOffset);
            }
            textScale.Render(str.Substring(this.scrollIndex), textBuffer);
        }
    }
Esempio n. 19
0
 public void Start()
 {
     // Obtain a reference to the dfTextbox instance attached to this object
     this.control = GetComponent <dfTextbox>();
 }
Esempio n. 20
0
 public static ISubscription bind(
     this IRxRef <uint> subject, dfTextbox control
     )
 {
     return(subject.bind(control, uintMapper, uintComapper));
 }
Esempio n. 21
0
 private void Awake()
 {
     textbox = FindObjectOfType<dfTextbox>();
 }
Esempio n. 22
0
 public void Start()
 {
     // Obtain a reference to the dfTextbox instance attached to this object
     this.control = GetComponent<dfTextbox>();
 }
Esempio n. 23
0
 public static ISubscription bind(
     this IRxRef <string> subject, dfTextbox control
     )
 {
     return(subject.bind(control, strMapper, strMapper));
 }