ProcessText() public méthode

Process the raw text, called when something changes.
public ProcessText ( ) : void
Résultat void
Exemple #1
0
    public static void Show(Vector3 position, String message)
    {
        if (QuadMistGetCardDialog.main.dialog != (UnityEngine.Object)null)
        {
            Singleton <DialogManager> .Instance.ReleaseDialogToPool(QuadMistGetCardDialog.main.dialog);

            QuadMistGetCardDialog.main.dialog = (Dialog)null;
        }
        UILabel dialogLabel = Singleton <DialogManager> .Instance.GetDialogLabel();

        Int32 width = dialogLabel.width;

        dialogLabel.width = Convert.ToInt32(UIManager.UIContentSize.x);
        dialogLabel.ProcessText();
        dialogLabel.UpdateNGUIText();
        Int32 num = Convert.ToInt32((NGUIText.CalculatePrintedSize2(message).x + Dialog.DialogPhraseXPadding * 2f) / UIManager.ResourceXMultipier) + 1;

        dialogLabel.width = width;
        QuadMistGetCardDialog.main.dialog = Singleton <DialogManager> .Instance.AttachDialog(String.Concat(new Object[]
        {
            "[STRT=",
            num,
            ",1][CENT][NANI][IMME]",
            message,
            "[TIME=-1]"
        }), 0, 1, Dialog.TailPosition.AutoPosition, Dialog.WindowStyle.WindowStylePlain, new Vector2(10000f, 10000f), Dialog.CaptionType.None);

        QuadMistGetCardDialog.main.dialog.transform.localPosition = new Vector3(0f, -220f);
    }
Exemple #2
0
    static int ProcessText(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        UILabel obj = (UILabel)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UILabel");

        obj.ProcessText();
        return(0);
    }
Exemple #3
0
    private IEnumerator ShowDialogWithCoroutine(Hand playerHand)
    {
        this.isReady = false;
        if (this.dialog != (UnityEngine.Object)null)
        {
            Singleton <DialogManager> .Instance.ReleaseDialogToPool(this.dialog);
        }
        String  text        = FF9TextTool.CardName((Int32)playerHand.SelectedUI.Data.id);
        UILabel dialogLabel = Singleton <DialogManager> .Instance.GetDialogLabel();

        Int32 oldWidth = dialogLabel.width;

        dialogLabel.width = Convert.ToInt32(UIManager.UIContentSize.x);
        dialogLabel.ProcessText();
        dialogLabel.UpdateNGUIText();
        Int32 width = Convert.ToInt32((NGUIText.CalculatePrintedSize2(text).x + Dialog.DialogPhraseXPadding * 2f) / UIManager.ResourceXMultipier) + 1;

        dialogLabel.width = oldWidth;
        this.dialog       = Singleton <DialogManager> .Instance.AttachDialog(String.Concat(new Object[]
        {
            "[STRT=",
            width,
            ",1][CENT][NANI][IMME]",
            text,
            "[TIME=-1]"
        }), 0, 1, Dialog.TailPosition.AutoPosition, Dialog.WindowStyle.WindowStylePlain, new Vector2(10000f, 10000f), Dialog.CaptionType.None);

        this.dialog.Panel.depth       -= 2;
        this.dialog.phrasePanel.depth -= 2;
        while (this.dialog.CurrentState != Dialog.State.CompleteAnimation)
        {
            yield return(new WaitForEndOfFrame());
        }
        Vector2       targetPosition = this.CalculateDialogTargetPosition(playerHand.Select, playerHand.Count);
        TweenPosition tweenPos       = this.dialog.GetComponent <TweenPosition>();

        if (tweenPos == (UnityEngine.Object)null)
        {
            tweenPos = this.dialog.gameObject.AddComponent <TweenPosition>();
        }
        tweenPos.ignoreTimeScale = false;
        tweenPos.from            = new Vector3(targetPosition.x + 800f, targetPosition.y);
        tweenPos.to = targetPosition;
        tweenPos.ResetToBeginning();
        tweenPos.duration       = 0.3f;
        tweenPos.enabled        = true;
        tweenPos.animationCurve = this.AnimationCurv;
        Single countDown = tweenPos.duration;

        while (countDown >= 0f)
        {
            countDown -= Time.deltaTime;
            yield return(new WaitForEndOfFrame());
        }
        UnityEngine.Object.Destroy(tweenPos);
        this.isReady = true;
        yield break;
    }
Exemple #4
0
 static public int ProcessText(IntPtr l)
 {
     try {
         UILabel self = (UILabel)checkSelf(l);
         self.ProcessText();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
	static int ProcessText(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 1);
			UILabel obj = (UILabel)ToLua.CheckObject<UILabel>(L, 1);
			obj.ProcessText();
			return 0;
		}
		catch (Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Exemple #6
0
    private void UpdateEmptySlotLabelSize(UILabel emptySlotLabel)
    {
        emptySlotLabel.SetAnchor((Transform)null);
        emptySlotLabel.updateAnchors = UIRect.AnchorUpdate.OnStart;
        Int32 width  = emptySlotLabel.width;
        Int32 height = emptySlotLabel.height;

        emptySlotLabel.width  = (Int32)UIManager.UIContentSize.x;
        emptySlotLabel.height = (Int32)UIManager.UIContentSize.y;
        emptySlotLabel.ProcessText();
        emptySlotLabel.UpdateNGUIText();
        Int32 num = (Int32)NGUIText.CalculatePrintedSize(emptySlotLabel.text).x + 3;

        emptySlotLabel.width  = (Int32)((width >= num) ? width : num);
        emptySlotLabel.height = height;
    }
 static public int ProcessText(IntPtr l)
 {
     try {
         UILabel        self = (UILabel)checkSelf(l);
         System.Boolean a1;
         checkType(l, 2, out a1);
         System.Boolean a2;
         checkType(l, 3, out a2);
         self.ProcessText(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #8
0
        public void Update(float elapsedms, InputManager input)
        {
            if (!LogPanel.Initialized)
            {
                return; // don't load until initialized
            }
            int logcount = Console.LogCount();

            if (logcount > LastLogNo)
            {
                while (logcount > LastLogNo)
                {
                    string s = Console.GetLog(LastLogNo);
                    ScrapLabel.Text = s;
                    ScrapLabel.ProcessText();

                    if (ScrapLabel.TextLines.Count > 1)
                    {
                        for (int i = 0; i < ScrapLabel.TextLines.Count; i++)
                        {
                            LogMsgs.Add(ScrapLabel.TextLines[i]);
                        }
                    }
                    else
                    {
                        LogMsgs.Add(s);
                    }

                    LastLogNo++;
                }

                while (LogMsgs.Count > LogsToLoad)
                {
                    LogMsgs.RemoveAt(0);
                }

                int c = 0;
                for (int i = LogMsgs.Count - 1; i >= 0; i--)
                {
                    UILabel lab = Labels[Labels.Count - 1 - c];
                    lab.Text = LogMsgs[i];
                    lab.ProcessText();
                    c++;
                }
            }
        }
    public static int ProcessText(IntPtr l)
    {
        int result;

        try
        {
            UILabel uILabel = (UILabel)LuaObject.checkSelf(l);
            uILabel.ProcessText();
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemple #10
0
        protected override void SelfRender(float elapsedms, GraphicsDevice g, SpriteBatch sb, InputManager input, float dx, float dy)
        {
            TrackedFrames++;
            TrackedTime += elapsedms / 1000.0f;
            if (TrackedTime >= 1.0)
            {
                double fps = TrackedFrames / TrackedTime;
                if (AttachedLabel != null)
                {
                    AttachedLabel.Text = "d" + fps.ToString("0.0");
                    AttachedLabel.ProcessText();
                    AttachedLabel.x = g.PresentationParameters.BackBufferWidth - TextHelper.GetWidth(AttachedLabel.SFont, AttachedLabel.TextLines[0], AttachedLabel.FontSettings);
                }

                TrackedTime   = 0;
                TrackedFrames = 0;
            }
        }
Exemple #11
0
        public void SetResultInfo(ISFSObject data, MahjongPlayer player, List <int> handCards, List <int> huList)
        {
            #region data

            int       type;
            long      totalGold;
            ISFSArray Groups;
            GameTools.TryGetValueWitheKey(data, out type, RequestKey.KeyType);
            GameTools.TryGetValueWitheKey(data, out _huNum, RequestKey.KeyHuNum);
            GameTools.TryGetValueWitheKey(data, out _gangNum, RequestKey.KeyGangNum);
            GameTools.TryGetValueWitheKey(data, out _fanName, RequestKey.KeyHuName);
            GameTools.TryGetValueWitheKey(data, out _totalNum, RequestKey.KeyGold);
            GameTools.TryGetValueWitheKey(data, out totalGold, RequestKey.KeyTotalGold);
            GameTools.TryGetValueWitheKey(data, out Groups, RequestKey.KeyGroups);
            var groups = GameTools.GetGroupData(Groups);
            YxDebug.Log("手牌总长度是:" + handCards.Count);
            _isWiner = type > 0;
            if (type == 2) //目前自摸情况下,会把胡的那张牌从手牌中带回来,这里删掉。目前只有一个胡牌,所以这么删,待扩展
            {
                handCards.Remove(huList[0]);
            }
            YxDebug.Log("手牌实际长度是:" + handCards.Count);

            #endregion

            #region UI

            LabelUserName.text = player.UserInfo.name;
            ZhuangSprite.SetActive(player.IsZhuang);
            LabelFanName.text = _fanName;
            YxTools.TrySetComponentValue(LabelHuScore, YxUtiles.GetShowNumber(_huNum).ToString());
            YxTools.TrySetComponentValue(LabelGangNum, YxUtiles.GetShowNumber(_gangNum).ToString());
            YxTools.TrySetComponentValue(LabelTotalScore, YxUtiles.GetShowNumber(_totalNum).ToString());
            HeadTexture.mainTexture = player.CurrentInfoPanel.UserIcon.mainTexture;
            player.UserInfo.Gold    = totalGold;
            player.CurrentInfoPanel.SetGold((int)totalGold);
            HuLogo.SetActive(IsWiner);

            #endregion

            _resultCards.Init(groups, handCards, huList, _isWiner);
            LabelFanName.ProcessText();
            NGUIText.Update();
        }
Exemple #12
0
        public void Update(float elapsedms, InputManager input)
        {
            TrackedFrames++;
            TrackedTime += elapsedms / 1000.0f;
            if (TrackedTime >= 1.0)
            {
                double fps = TrackedFrames / TrackedTime;
                FRLabel.Text = "u" + fps.ToString("0.0");
                FRLabel.ProcessText();
                FRLabel.x = GraphicsDevice.PresentationParameters.BackBufferWidth - TextHelper.GetWidth(FRLabel.SFont, FRLabel.TextLines[0], FRLabel.FontSettings);

                TrackedTime   = 0;
                TrackedFrames = 0;
            }

            //TLabel.Text = time.TotalTime.Hours + ":" + time.TotalTime.Minutes + ":" + time.TotalTime.Seconds;
            //TLabel.ProcessText();
            //TLabel.x = GraphicsDevice.PresentationParameters.BackBufferWidth - TextHelper.GetWidth(TLabel.SFont, TLabel.TextLines[0], TLabel.FontSettings);
        }
Exemple #13
0
 void RefreshAllLables(Font font)
 {
     UIPanel[] panels = UnityEngine.GameObject.FindObjectsOfType <UIPanel>() as UIPanel[];
     for (int i = 0; i < panels.Length; i++)
     {
         foreach (UIWidget widget in panels[i].widgets)
         {
             if (widget.GetType() == typeof(UILabel) || widget.GetType() == typeof(UIColorLabel))
             {
                 UILabel lbl = widget as UILabel;
                 if (lbl.TrueTypeFont == font)
                 {
                     lbl.MarkAsChanged();
                     lbl.ProcessText();
                     lbl.UpdateGeometry(ref panels[i].mWorldToLocal, (lbl.changeFlag == 1));
                 }
             }
         }
         panels[i].Fill();
     }
 }
        public static void AddButtonToMainMenu(string name, string title, EventDelegate.Callback buttonClickCallback, int order)
        {
            try
            {
                DistanceLoader.Util.Logger.Instance.Log($"[MainMenu-AddButtonToMainMenu] Adding new button to Main Menu {name}|{title}");

                var distanceLoaderMenuItem = new GameObject(name);
                distanceLoaderMenuItem.SetActive(false);
                distanceLoaderMenuItem.transform.SetParent(GameObject.Find("MainButtons").transform);
                distanceLoaderMenuItem.transform.SetSiblingIndex(order);
                distanceLoaderMenuItem.layer = 22;
                distanceLoaderMenuItem.transform.position += new Vector3(100, 100, 0);

                UIExButton newUiExButton            = distanceLoaderMenuItem.AddComponent <UIExButton>();
                var        distanceLoaderMenuButton = new EventDelegate(buttonClickCallback)
                {
                    oneShot = false
                };
                if (!distanceLoaderMenuButton.isValid)
                {
                    // The button callback is not valid, this button will never work - destroy it
                    distanceLoaderMenuItem.Destroy();
                    return;
                }

                // Attaches our Callback event to the button
                newUiExButton.name    = $"{name}_Button";
                newUiExButton.onClick = new List <EventDelegate>()
                {
                    distanceLoaderMenuButton
                };
                newUiExButton.transform.SetParent(distanceLoaderMenuItem.transform);
                newUiExButton.SetState(UIButtonColor.State.Normal, true);
                newUiExButton.disabledColor = Color.grey;
                newUiExButton.defaultColor  = Color.white;
                newUiExButton.SetButtonColor(Color.white);
                newUiExButton.enabled = true;

                // Not sure what this does, but it was needed in the original buttons
                BoxCollider newBoxCollider = distanceLoaderMenuItem.AddComponent <BoxCollider>();
                newBoxCollider.name = $"{name}_BoxCollider";
                newBoxCollider.transform.SetParent(distanceLoaderMenuItem.transform);
                newBoxCollider.size      = new Vector3(205f, 36f, 0f);
                newBoxCollider.center    = new Vector3(-1.2f, -0.2f, 0f);
                newBoxCollider.enabled   = true;
                newBoxCollider.isTrigger = true;

                // Adds the ability to handle controller/keyboard menu navigation
                UIKeyNavigation newUiKeyNavigation = distanceLoaderMenuItem.AddComponent <UIKeyNavigation>();
                newUiKeyNavigation.name = $"{name}_KeyNav";
                newUiKeyNavigation.transform.SetParent(distanceLoaderMenuItem.transform);
                newUiKeyNavigation.startsSelected = false;

                // The label of the button, the actual text
                // This still makes the text purple after clicking it, unsure why yet
                UILabel newUiLabel = distanceLoaderMenuItem.AddComponent <UILabel>();
                newUiLabel.name        = $"{name}_Label";
                newUiLabel.text        = title;
                newUiLabel.fontSize    = 32;
                newUiLabel.fontStyle   = FontStyle.Normal;
                newUiLabel.color       = Color.white;
                newUiLabel.effectColor = Color.blue;

                // Copies the font from the current "CAMPAIGN" button on the main menu.
                // Unity (according to forums) does not support creating new TrueType fonts during runtime, so we can just create a copy instead :)
                newUiLabel.trueTypeFont = GameObject.Find("MainButtons").GetChild(0).GetComponentInChildren <UILabel>().trueTypeFont;
                newUiLabel.transform.SetParent(distanceLoaderMenuItem.transform);
                newUiLabel.ProcessText();
                newUiLabel.Update();

                // Activate the whole new GameObject
                distanceLoaderMenuItem.SetActive(true);
            }
            catch (Exception ex)
            {
                DistanceLoader.Util.Logger.Instance.Log("[MainMenu-AddButtonToMainMenu] Exception", ex);
            }
        }
Exemple #15
0
 public void OnEnable()
 {
     if (this._action != InputMappingIcons.Actions.None && (!this._gamepadOnly || TheForest.Utils.Input.IsGamePad || ForestVR.Enabled))
     {
         this._registeredAsBigIcon = (this._useBigIcon || (TheForest.Utils.Input.IsGamePad && this._useBigIconForGamepad));
         Transform transform = base.transform;
         InputMappingIcons.Actions           action            = this._action;
         ActionIcon.SideIconTypes            sideIcon          = this._sideIcon;
         ActionIconSystem.CurrentViewOptions currentViewOption = this._currentViewOption;
         bool       useAltTextIcon      = this._useAltTextIcon;
         bool       registeredAsBigIcon = this._registeredAsBigIcon;
         string     actionTextOverride  = this._actionTextOverride;
         ActionIcon actionIcon          = ActionIconSystem.RegisterIcon(transform, action, sideIcon, currentViewOption, useAltTextIcon, registeredAsBigIcon, null, actionTextOverride, false);
         if (actionIcon)
         {
             this._fillSprite = actionIcon._fillSprite;
             if (this._fillSprite)
             {
                 if (this._fillSprite.gameObject.activeSelf != this._useFillSprite)
                 {
                     this._fillSprite.gameObject.SetActive(this._useFillSprite);
                 }
                 if (this._useFillSprite && actionIcon._fillSpriteAction)
                 {
                     actionIcon._fillSpriteAction.SetAction(this._action);
                 }
             }
             if (actionIcon._sprite && this._widget && this._refreshSiblings)
             {
                 Transform target = this._widget.leftAnchor.target;
                 this._widget.leftAnchor.target = null;
                 this._widget.width             = Mathf.RoundToInt((float)actionIcon._sprite.width / base.transform.localScale.x);
                 this._widget.leftAnchor.target = target;
                 this._widget.SkipWidthUpdate   = true;
                 IEnumerator enumerator = base.transform.GetEnumerator();
                 try
                 {
                     while (enumerator.MoveNext())
                     {
                         object    obj        = enumerator.Current;
                         Transform transform2 = (Transform)obj;
                         UILabel   component  = transform2.GetComponent <UILabel>();
                         if (component)
                         {
                             component.MarkAsChanged();
                             component.ProcessText();
                         }
                     }
                 }
                 finally
                 {
                     IDisposable disposable;
                     if ((disposable = (enumerator as IDisposable)) != null)
                     {
                         disposable.Dispose();
                     }
                 }
             }
         }
     }
     if (this._sprite)
     {
         this._sprite.enabled = false;
     }
     if (this._label)
     {
         this._label.enabled = false;
     }
 }
Exemple #16
0
        public TestUI(UIStyle style, GraphicsDevice graphicsDevice)
        {
            UISystem = new UISystem(graphicsDevice);
            // panel 1
            UIPanel panel = new UIPanel(25, 25, 150, 150, hastitle: true, title: "Test Panel 1", titlesize: 16);

            UISystem.Add(panel);

            UILabel label1 = new UILabel(0, 0, panel.Width - 10, 10, "text goes here let's see if it will wrap automatically, which it should if everything is working properly.", fontsize: 12,
                                         font: "NotoSans_regular"); // test spritefont

            panel.AddAuto(label1);

            // panel 2
            UIPanel panel2 = new UIPanel(225, 25, 150, 150, hastitle: true, title: "Test Panel 2", titlesize: 16);

            UISystem.Add(panel2);

            UIButton button1 = new UIButton(5, 5, 75, 25, "Test Button");

            panel2.AddAuto(button1);

            UICheckbox chk1 = new UICheckbox(5, 40, 20, 20);

            panel2.Add(chk1);
            UILabel chk1label = new UILabel(30, 40, 100, 20, "unchecked");

            panel2.Add(chk1label);
            chk1.EventCheckChanged += (sender, args) =>
            {
                if (chk1.Checked)
                {
                    chk1label.Text = "checked";
                }
                else
                {
                    chk1label.Text = "unchecked";
                }
                chk1label.ProcessText();
            };


            // panel 3
            UIPanel panel3 = new UIPanel(425, 25, 150, 150, hastitle: true, title: "Test Panel 3", titlesize: 12);

            UISystem.Add(panel3);

            UITextField textfield1 = new UITextField(5, 5, 135, 25, "", fontsize: 16, placeholdertext: "Try Typing...");

            panel3.AddAuto(textfield1);

            UINumberField numfield1 = new UINumberField(5, 5, 135, 35, 40, "0", true, fontsize: 16);

            panel3.AddAuto(numfield1);

            UINumberField numfield2 = new UINumberField(5, 5, 135, 35, 40, "0.0", false, fontsize: 16);

            panel3.AddAuto(numfield2);

            // panel 4
            UIPanel panel4 = new UIPanel(625, 25, 150, 150, hastitle: true, title: "Test Panel 4", titlesize: 14);

            UISystem.Add(panel4);

            UILabel label2 = new UILabel(0, 0, panel4.Width - 10, 10, "text goes here let's see if it will wrap automatically, which it should if everything is working properly.", fontsize: 18);

            label2.TextSplitWords = true;
            panel4.AddAuto(label2);
            UILabel label3 = new UILabel(0, 10, panel4.Width - 10, 10, "A second auto-label. This gal should automatically get cut off when it goes too long", fontsize: 16);

            label3.TextSplitWords = true;
            panel4.AddAuto(label3);

            // panel 5
            UIPanel panel5 = new UIPanel(25, 200, 150, 150, true, "Dropdown Test");

            UISystem.Add(panel5);

            UIDropdown drop1 = new UIDropdown(0, 0, 80, 30, "droptest");

            drop1.AddItem("log A", (uid, args) => { drop1.Text = "AAAA"; drop1.ProcessText(); });
            drop1.AddItem("log B", (uid, args) => { drop1.Text = "BBBB"; drop1.ProcessText(); });
            panel5.AddAuto(drop1);

            // panel 6
            UIPanel panel6 = new UIPanel(200, 200, 150, 150, true, "Scroll Vert Test", hasscrolling: true, scrollh: 400);

            UISystem.Add(panel6);
            UILabel label4 = new UILabel(0, 10, panel6.Width - 20, 350, "newlines \n should be auto processed 1\n 2\n 3\n 4\n 5\n test the bottom \n test", fontsize: 16);

            panel6.AddAuto(label4);

            // panel 7
            UIPanel panel7 = new UIPanel(400, 200, 150, 150, true, "Scroll Horz Test", hasscrolling: true, scrollw: 400);

            UISystem.Add(panel7);
            UILabel label5 = new UILabel(0, 10, panel7.ScrollWidth - 10, 10, "a very long bit a text. It just goes on and on and doesn't end. A very long line that should be much smaller. But it's not, it's very large, instead.", fontsize: 18);

            panel7.AddAuto(label5);

            // panel 8
            UIPanel panel8 = new UIPanel(600, 200, 150, 150, true, "Dialogs Test");

            UISystem.Add(panel8);
            UIButton popupbtn = new UIButton(0, 0, 100, 30, "pop up");

            panel8.AddAuto(popupbtn);
            UIButton filebtn = new UIButton(0, 0, 100, 30, "open file");

            panel8.AddAuto(filebtn);

            popupbtn.EventFocused += (sender, args) =>
            {
                UIComponent.EventFocusedHandlerArgs eargs = args as UIComponent.EventFocusedHandlerArgs;
                DialogPopup popup = new DialogPopup("Popup", "time elapsed: " + eargs.ElapsedMS);
                popup.Popup(UISystem);
                popup.EventClosed += (innersender, innerargs) =>
                {
                    popup.Dispose();
                };
            };
            filebtn.EventFocused += (sender, args) =>
            {
                UIComponent.EventFocusedHandlerArgs eargs = args as UIComponent.EventFocusedHandlerArgs;
                DialogFile filepopup = new DialogFile(DialogFile.eMode.SELECT_FILE, ".\\", "file.txt", "Select a File");
                filepopup.Popup(UISystem);
                filepopup.EventClosed += (innersender, innerargs) =>
                {
                    filepopup.Dispose();
                };
            };

            // panel 9
            UIPanel panel9 = new UIPanel(100, 350, 220, 100);

            UISystem.Add(panel9);
            UITextField multiLineText = new UITextField(0, 0, 200, 80, "", autoheight: false, placeholdertext: "try typing multi lines", fontsize: 11)
            {
                MultiLine = true
            };

            multiLineText.SetTextStyler(new TextStylerTest());
            panel9.Add(multiLineText);

            // panel 10
            UIPanel panel10 = new UIPanel(20, 20, 400, 400, true, "RelaScript", titlesize: 12, hasclose: true);

            panel10.CloseButton.EventFocused += (sender, eargs) =>
            {
                panel10.Visible = false;
            };
            UISystem.Add(panel10);
            UITextField relaMultiText = new UITextField(5, 5, 380, 350, "", autoheight: false,
                                                        fontsize: 18, font: "NotoMono-Regular")
            {
                MultiLine = true
            };

            relaMultiText.EventPostInit += (sender, eargs) =>
            {
                relaMultiText.TextColor = new Microsoft.Xna.Framework.Color(218, 218, 218, 255);
            };
            relaMultiText.SetTextStyler(new TextStylerRelaScript());
            panel10.Add(relaMultiText);

            UISystem.Init(style);
        }
Exemple #17
0
    public override void Show(UIDialogeOption option)
    {
        base.Show(option);

        if (Option != option)
        {
            // queued
            return;
        }

        if (option is UICustomeDialogueOption == false)
        {
            return;
        }

        mCustomOption = option as UICustomeDialogueOption;

        // set style
        if (mCustomOption.accept != null && acceptButton != null && acceptObject != null && acceptObject.activeSelf)
        {
            UILabel acceptLabel = acceptButton.GetComponentInChildren <UILabel>();
            if (acceptLabel != null)
            {
                mOriginAccept    = acceptLabel.text;
                acceptLabel.text = mCustomOption.accept;
            }
        }

        if (mCustomOption.decline != null && declineButton != null && declineObject != null && declineObject.activeSelf)
        {
            UILabel declineLabel = declineButton.GetComponentInChildren <UILabel>();
            if (declineLabel != null)
            {
                mOriginDecline    = declineLabel.text;
                declineLabel.text = mCustomOption.decline;
            }
        }

        if (mCustomOption.cancel != null && cancelButton != null && cancelObject != null && cancelObject.activeSelf)
        {
            UILabel cancelLabel = cancelButton.GetComponentInChildren <UILabel>();
            if (cancelLabel != null)
            {
                mOriginCancel    = cancelLabel.text;
                cancelLabel.text = mCustomOption.cancel;
            }
        }

        if (body != null && body.activeSelf)
        {
            UILabel bodyLabel = body.GetComponentInChildren <UILabel>();

            mOriginAllianment = bodyLabel.alignment;
            mOriginOverflow   = bodyLabel.overflowMethod;
            mOriginHeight     = bodyLabel.height;
            mOriginSpace      = bodyLabel.spacingY;

            //bodyLabel.alignment = mCustomOption.alignment;
            if (mCustomOption.lineSpace != 0)
            {
                bodyLabel.spacingY = mCustomOption.lineSpace;
            }
            if (mCustomOption.minHeight != 0)
            {
                bodyLabel.ProcessText();
                if (bodyLabel.height < mCustomOption.minHeight)
                {
                    bodyLabel.overflowMethod = UILabel.Overflow.ShrinkContent;
                    bodyLabel.height         = Mathf.Max(bodyLabel.height, mCustomOption.minHeight);
                }
            }

            UISprite bodyBackground = body.GetComponentInChildren <UISprite>(true);
            if (bodyBackground != null)
            {
                mOriginBodyBackgroundEnabled = bodyBackground.enabled;
                bodyBackground.enabled       = !mCustomOption.hideBodyBackground;
            }
        }
    }