void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
Пример #2
0
 void H_Line2Setup()
 {
     line2Group = headerGroup.Find("Line2Group");
     button1    = new ButtonHelper(line2Group.transform.Find("Button1").gameObject);
     textInput  = new InputFieldHelper(line2Group.transform.Find("InputField").gameObject);
     button2    = new ButtonHelper(line2Group.transform.Find("Button2").gameObject);
 }
    private void PrintChoise()
    {
        if (mMsgChoise.Count > 0)
        {
            string urlPopup_bt = "ui://BlueSkin/Button_choise_w";
            UIObjectFactory.SetPackageItemExtension(urlPopup_bt, typeof(GButton_TypingEffect));
            var popup = InputFieldHelper.Instance.ShowPopupAction_Conversation();
            popup.contentPane.width = 450;
            bool isOffsetOnRight = false;
            for (int i = 0; i < mMsgChoise.Count; i++)
            {
                var c = mMsgChoise[i];
                if (!isOffsetOnRight && !string.IsNullOrEmpty(c.choise.ContentHighlight))
                {
                    isOffsetOnRight = true;
                }
                // var t = c.Value != "" ? c.Value : ( c.Next != null ? "Next" : "");
                var t         = c.text;
                int idxChoise = i;
                var bt        = popup.AddItemWithUrl(urlPopup_bt, t, (EventContext context) => {
                    this._onChoise(popup, idxChoise, c.choise);
                });
                bt.GetController("c1").SetSelectedIndex(0);
                PreItemShowHighlight(c, bt);
            }
            popup.ResizeWidthMinFromItems(isOffsetOnRight);
            popup.ResizeHeightToFix();
            {
                //Animation Show
                float delay = 0f;
                for (int i = 0; i < popup.itemCount; i++)
                {
                    GObject obj = popup.ItemAt(i);
                    if (obj != null && obj is GButton_TypingEffect)
                    {
                        GButton_TypingEffect gBt = (GButton_TypingEffect)obj;
                        // gBt.PlayTypingEffect();
                        gBt.PlayEffect(delay);
                        delay += 0.2f;
                    }
                }
            }
            //Disable scroll
            if (popup.list.scrollPane != null)
            {
                popup.list.scrollPane.touchEffect = false;
            }
            {
                //AddArrowTalker
                GameObject objListener = null;
                GameObject objTalker   = null;
                GetTalkerObj(mMsgChoise[0].talker, ref objListener, ref objTalker);
                var _c        = popup.contentPane;
                var _mainView = _c.parent;

                float posFrameLeft  = 10;
                float posFrameRight = _mainView.width - _c.width - 10;
                float posFrameTop   = 86;
                float posFrameBot   = _mainView.height - _c.height - 86;

                InputFieldHelper.AddArrowTalker(objListener, objTalker, popup.contentPane, posFrameTop, posFrameBot, posFrameLeft, posFrameRight);
            }
        }
    }