public override void Initialize(CUIFormScript formScript)
 {
     if (this.m_isInitialized)
     {
         return;
     }
     base.Initialize(formScript);
     for (int i = 0; i < base.gameObject.transform.childCount; i++)
     {
         GameObject gameObject = base.gameObject.transform.GetChild(i).gameObject;
         if (this.m_elementTemplate == null)
         {
             this.m_elementTemplate      = gameObject;
             this.m_elementName          = gameObject.name;
             this.m_elementTemplate.name = this.m_elementName + "_Template";
             if (this.m_elementTemplate.activeSelf)
             {
                 this.m_elementTemplate.SetActive(false);
             }
         }
         gameObject.SetActive(false);
     }
     if (this.m_prepareElementAmount > 0)
     {
         for (int j = 0; j < this.m_prepareElementAmount; j++)
         {
             GameObject gameObject2 = base.Instantiate(this.m_elementTemplate);
             gameObject2.gameObject.name = this.m_elementName;
             base.InitializeComponent(gameObject2.gameObject);
             if (gameObject2.activeSelf)
             {
                 gameObject2.SetActive(false);
             }
             if (gameObject2.transform.parent != base.gameObject.transform)
             {
                 gameObject2.transform.SetParent(base.gameObject.transform, true);
                 gameObject2.transform.localScale = Vector3.one;
             }
             this.m_unusedElements.Add(gameObject2);
         }
     }
 }
 public override void Initialize(CUIFormScript formScript)
 {
     if (this.m_isInitialized)
     {
         return;
     }
     if (this.m_isMultiSelected)
     {
         this.m_multiSelected = new bool[this.m_elementAmount];
         for (int i = 0; i < this.m_elementAmount; i++)
         {
             this.m_multiSelected[i] = false;
         }
     }
     else
     {
         this.m_selected = -1;
     }
     base.Initialize(formScript);
 }
Esempio n. 3
0
 public override void Initialize(CUIFormScript formScript)
 {
     if (!base.m_isInitialized)
     {
         this.m_slider = base.gameObject.GetComponent <Slider>();
         if (this.m_slider != null)
         {
             this.m_DescribeCount = base.transform.Find("Background").childCount;
             this.m_Describes     = new Text[this.m_DescribeCount];
             for (int i = 0; i < this.m_DescribeCount; i++)
             {
                 this.m_Describes[i] = base.transform.Find(string.Format("Background/Text{0}", i + 1)).GetComponent <Text>();
             }
             this.m_Handletext = base.transform.Find("Handle Slide Area/Handle/Text").GetComponent <Text>();
             this.m_slider.onValueChanged.RemoveAllListeners();
             this.m_slider.onValueChanged.AddListener(new UnityAction <float>(this.OnSliderValueChanged));
             base.Initialize(formScript);
         }
     }
 }
Esempio n. 4
0
        public CUIFormScript GetTopForm()
        {
            CUIFormScript script = null;

            for (int i = 0; i < this.m_forms.Count; i++)
            {
                if (this.m_forms[i] != null)
                {
                    if (script == null)
                    {
                        script = this.m_forms[i];
                    }
                    else if (this.m_forms[i].GetSortingOrder() > script.GetSortingOrder())
                    {
                        script = this.m_forms[i];
                    }
                }
            }
            return(script);
        }
 public override void Initialize(CUIFormScript formScript)
 {
     if (!base.m_isInitialized)
     {
         this.m_inputField = base.gameObject.GetComponent <InputField>();
         this.m_inputField.onValueChange.RemoveAllListeners();
         this.m_inputField.onValueChange.AddListener(new UnityAction <string>(this.OnTextContentChanged));
         if (this.m_displayReminderText != null)
         {
             if (this.m_countType == enCountType.CountDown)
             {
                 this.m_displayReminderText.text = this.m_inputField.characterLimit.ToString();
             }
             else if (this.m_countType == enCountType.CountUp)
             {
                 this.m_displayReminderText.text = 0.ToString();
             }
         }
         base.Initialize(formScript);
     }
 }
Esempio n. 6
0
 public override void Initialize(CUIFormScript formScript)
 {
     if (this.m_isInitialized)
     {
         return;
     }
     this.LoadRes();
     this.InitializeRenderers();
     base.Initialize(formScript);
     if (this.m_isFixScaleToForm)
     {
         this.ResetScale();
     }
     if (this.m_isFixScaleToParticleSystem)
     {
         this.ResetParticleScale();
     }
     if (this.m_belongedFormScript.IsHided())
     {
         this.Hide();
     }
 }
Esempio n. 7
0
 public override void Initialize(CUIFormScript formScript)
 {
     if (this.m_isInitialized)
     {
         return;
     }
     this.m_image = base.gameObject.GetComponent <Image>();
     if (this.m_image == null)
     {
         return;
     }
     if (this.m_image.type != Image.Type.Filled)
     {
         return;
     }
     if (this.m_startFillAmount >= this.m_endFillAmount)
     {
     }
     this.m_fillRate  = (this.m_endFillAmount - this.m_startFillAmount) / 1f;
     this.m_isRunning = false;
     base.Initialize(formScript);
 }
Esempio n. 8
0
 public override void Initialize(CUIFormScript formScript)
 {
     if (this.m_isInitialized)
     {
         return;
     }
     this.m_inputField = base.gameObject.GetComponent <InputField>();
     this.m_inputField.get_onValueChange().RemoveAllListeners();
     this.m_inputField.get_onValueChange().AddListener(new UnityAction <string>(this.OnTextContentChanged));
     if (this.m_displayReminderText != null)
     {
         if (this.m_countType == CUIInputReminderScript.enCountType.CountDown)
         {
             this.m_displayReminderText.set_text(this.m_inputField.get_characterLimit().ToString());
         }
         else if (this.m_countType == CUIInputReminderScript.enCountType.CountUp)
         {
             this.m_displayReminderText.set_text(0.ToString());
         }
     }
     base.Initialize(formScript);
 }
 public override void Initialize(CUIFormScript formScript)
 {
     if (this.m_isInitialized)
     {
         return;
     }
     base.Initialize(formScript);
     this.m_axisRectTransform = (base.gameObject.transform.FindChild("Axis") as RectTransform);
     if (this.m_axisRectTransform != null)
     {
         this.m_axisRectTransform.anchoredPosition = Vector2.zero;
         this.m_axisOriginalScreenPosition         = CUIUtility.WorldToScreenPoint(this.m_belongedFormScript.GetCamera(), this.m_axisRectTransform.position);
         this.m_axisImage           = this.m_axisRectTransform.gameObject.GetComponent <Image>();
         this.m_cursorRectTransform = (this.m_axisRectTransform.FindChild("Cursor") as RectTransform);
         if (this.m_cursorRectTransform != null)
         {
             this.m_cursorRectTransform.anchoredPosition = Vector2.zero;
             this.m_cursorImage = this.m_cursorRectTransform.gameObject.GetComponent <Image>();
         }
         this.AxisFadeout();
         this.m_vecAxisAnchorMin = this.m_axisRectTransform.anchorMin;
         this.m_vecAxisAnchorMax = this.m_axisRectTransform.anchorMax;
     }
     this.m_joystickRectTransform = (base.gameObject.transform as RectTransform);
     if (this.m_joystickRectTransform != null)
     {
         this.m_vecJoystickSize = this.m_joystickRectTransform.sizeDelta;
     }
     this.m_borderRectTransform = (base.gameObject.transform.FindChild("Axis/Border") as RectTransform);
     if (this.m_borderRectTransform != null)
     {
         this.m_borderCanvasGroup = this.m_borderRectTransform.gameObject.GetComponent <CanvasGroup>();
         if (this.m_borderCanvasGroup == null)
         {
             this.m_borderCanvasGroup = this.m_borderRectTransform.gameObject.AddComponent <CanvasGroup>();
         }
         this.HideBorder();
     }
 }
Esempio n. 10
0
        public override void Initialize(CUIFormScript formScript)
        {
            if (this.m_isInitialized)
            {
                return;
            }
            base.Initialize(formScript);
            this.m_scrollRectScript = CUIUtility.GetComponentInChildren <ScrollRect>(base.gameObject);
            this.m_textScript       = ((!(this.m_scrollRectScript != null)) ? null : CUIUtility.GetComponentInChildren <Text>(this.m_scrollRectScript.gameObject));
            Transform transform = base.gameObject.transform.FindChild("Title");

            this.m_titleTextScript = ((!(transform != null)) ? null : CUIUtility.GetComponentInChildren <Text>(transform.gameObject));
            this.m_httpTextState   = enHttpTextState.Unload;
            if (this.m_loadingCover != null)
            {
                this.m_loadingCover.CustomSetActive(true);
            }
            if (base.gameObject.activeInHierarchy && !string.IsNullOrEmpty(this.m_textUrl))
            {
                this.LoadText(this.m_textUrl);
            }
        }
Esempio n. 11
0
        private GameObject CreateForm(string formPrefabPath, bool useFormPool)
        {
            GameObject gameObject = null;

            if (useFormPool)
            {
                for (int i = 0; i < this.m_pooledForms.Count; i++)
                {
                    if (string.Equals(formPrefabPath, this.m_pooledForms[i].m_formPath, StringComparison.OrdinalIgnoreCase))
                    {
                        this.m_pooledForms[i].Appear(enFormHideFlag.HideByCustom, true);
                        gameObject = this.m_pooledForms[i].gameObject;
                        this.m_pooledForms.RemoveAt(i);
                        break;
                    }
                }
            }
            if (gameObject == null)
            {
                GameObject content = (GameObject)Singleton <CResourceManager> .GetInstance().GetResource(formPrefabPath, typeof(GameObject), enResourceType.UIForm, false, false).m_content;

                if (content == null)
                {
                    return(null);
                }
                gameObject = (GameObject)UnityEngine.Object.Instantiate(content);
            }
            if (gameObject != null)
            {
                CUIFormScript component = gameObject.GetComponent <CUIFormScript>();
                if (component != null)
                {
                    component.m_useFormPool = useFormPool;
                }
            }
            return(gameObject);
        }
        public override void Initialize(CUIFormScript formScript)
        {
            if (this.m_isInitialized)
            {
                return;
            }
            this.m_listType            = enUIListType.Horizontal;
            this.m_elementSpacing      = Vector2.zero;
            this.m_elementLayoutOffset = 0f;
            int elementAmount = this.m_elementAmount;

            this.m_elementAmount = 0;
            base.Initialize(formScript);
            CUIListElementScript component = this.m_elementTemplate.GetComponent <CUIListElementScript>();

            if (component != null)
            {
                component.m_pivotType = enPivotType.Centre;
            }
            this.m_contentExtendSize = (this.m_scrollAreaSize.x - this.m_elementDefaultSize.x) * 0.5f;
            this.m_stepListCenter    = this.m_contentExtendSize + this.m_elementDefaultSize.x * 0.5f;
            this.m_selectAreaMin     = this.m_contentExtendSize;
            this.m_selectAreaMax     = this.m_scrollAreaSize.x - this.m_contentExtendSize;
            if (this.m_scrollRect != null)
            {
                this.m_scrollRectLastScrollSpeed = this.m_scrollRect.get_velocity().x;
            }
            if (this.m_elementsRect == null)
            {
                this.m_elementsRect = new List <stRect>();
            }
            base.SetElementAmount(elementAmount);
            if (this.m_elementAmount > 0)
            {
                this.SelectElementImmediately(0);
            }
        }
Esempio n. 13
0
 public override void Initialize(CUIFormScript formScript)
 {
     if (!base.m_isInitialized)
     {
         base.Initialize(formScript);
         this.m_image = base.gameObject.GetComponent <Image>();
         if (this.m_image != null)
         {
             this.m_defaultSprite = this.m_image.sprite;
             this.m_defaultColor  = this.m_image.color;
             if (this.m_image is Image2)
             {
                 Image2 image = this.m_image as Image2;
                 this.m_defaultLayout = image.alphaTexLayout;
             }
         }
         if (this.m_autoAddUIEventScript && (base.gameObject.GetComponent <CUIEventScript>() == null))
         {
             base.gameObject.AddComponent <CUIEventScript>().Initialize(formScript);
         }
         if (!this.m_useSetActiveForDisplay)
         {
             this.m_canvasGroup = base.gameObject.GetComponent <CanvasGroup>();
             if (this.m_canvasGroup == null)
             {
                 this.m_canvasGroup = base.gameObject.AddComponent <CanvasGroup>();
             }
         }
         this.m_defaultSize = this.GetDefaultSize();
         this.InitRectTransform();
         if (this.m_textObj != null)
         {
             this.m_defaultTextColor = this.m_textObj.color;
         }
     }
 }
Esempio n. 14
0
        private void OpenInputBoxBase(string title, string inputTip, enUIEventID confirmID, enUIEventID cancelID, stUIEventParams par, string confirmStr = "确定", string cancelStr = "取消")
        {
            CUIFormScript script = Singleton <CUIManager> .GetInstance().OpenForm("UGUI/Form/Common/Form_InputBox.prefab", false, false);

            GameObject gameObject = null;

            if (script != null)
            {
                gameObject = script.gameObject;
            }
            if (gameObject != null)
            {
                GameObject obj3 = gameObject.transform.Find("Panel/btnGroup/Button_Confirm").gameObject;
                obj3.GetComponentInChildren <Text>().text = confirmStr;
                GameObject obj4 = gameObject.transform.Find("Panel/btnGroup/Button_Cancel").gameObject;
                obj4.GetComponentInChildren <Text>().text = cancelStr;
                gameObject.transform.Find("Panel/title/Text").GetComponent <Text>().text            = title;
                gameObject.transform.Find("Panel/inputText/Placeholder").GetComponent <Text>().text = inputTip;
                CUIEventScript component = obj3.GetComponent <CUIEventScript>();
                CUIEventScript script3   = obj4.GetComponent <CUIEventScript>();
                component.SetUIEvent(enUIEventType.Click, confirmID, par);
                script3.SetUIEvent(enUIEventType.Click, cancelID, par);
            }
        }
Esempio n. 15
0
        public override void Initialize(CUIFormScript formScript)
        {
            if (this.m_isInitialized)
            {
                return;
            }
            this.m_toggle = base.gameObject.GetComponent <Toggle>();
            this.m_toggle.onValueChanged.RemoveAllListeners();
            this.m_toggle.onValueChanged.AddListener(new UnityAction <bool>(this.OnToggleValueChanged));
            Transform transform = base.gameObject.transform.FindChild("Label");

            if (transform != null)
            {
                if (this.m_toggle.isOn)
                {
                    transform.GetComponent <Text>().color = CUIUtility.s_Color_White;
                }
                else
                {
                    transform.GetComponent <Text>().color = CUIUtility.s_Text_Color_ListElement_Normal;
                }
            }
            base.Initialize(formScript);
        }
Esempio n. 16
0
        public override void Initialize(CUIFormScript formScript)
        {
            if (this.m_isInitialized)
            {
                return;
            }
            base.Initialize(formScript);
            this.m_selectedElementIndex     = -1;
            this.m_lastSelectedElementIndex = -1;
            this.m_scrollRect = base.GetComponentInChildren <ScrollRect>(base.gameObject);
            if (this.m_scrollRect != null)
            {
                this.m_scrollRect.enabled = false;
                RectTransform rectTransform = this.m_scrollRect.transform as RectTransform;
                this.m_scrollAreaSize = new Vector2(rectTransform.rect.width, rectTransform.rect.height);
                this.m_content        = this.m_scrollRect.get_content().gameObject;
            }
            this.m_scrollBar = base.GetComponentInChildren <Scrollbar>(base.gameObject);
            if (this.m_listType == enUIListType.Vertical || this.m_listType == enUIListType.VerticalGrid)
            {
                if (this.m_scrollBar != null)
                {
                    this.m_scrollBar.set_direction(2);
                }
                DebugHelper.Assert(this.m_scrollRect != null);
                if (this.m_scrollRect != null)
                {
                    this.m_scrollRect.set_horizontal(false);
                    this.m_scrollRect.set_vertical(true);
                    this.m_scrollRect.set_horizontalScrollbar(null);
                    this.m_scrollRect.set_verticalScrollbar(this.m_scrollBar);
                }
            }
            else if (this.m_listType == enUIListType.Horizontal || this.m_listType == enUIListType.HorizontalGrid)
            {
                if (this.m_scrollBar != null)
                {
                    this.m_scrollBar.set_direction(0);
                }
                DebugHelper.Assert(this.m_scrollRect != null);
                if (this.m_scrollRect != null)
                {
                    this.m_scrollRect.set_horizontal(true);
                    this.m_scrollRect.set_vertical(false);
                    this.m_scrollRect.set_horizontalScrollbar(this.m_scrollBar);
                    this.m_scrollRect.set_verticalScrollbar(null);
                }
            }
            this.m_elementScripts       = new ListView <CUIListElementScript>();
            this.m_unUsedElementScripts = new ListView <CUIListElementScript>();
            if (this.m_useOptimized && this.m_elementsRect == null)
            {
                this.m_elementsRect = new List <stRect>();
            }
            CUIListElementScript cUIListElementScript = null;

            if (this.m_useExternalElement)
            {
                GameObject gameObject = null;
                if (this.m_externalElementPrefabPath != null)
                {
                    gameObject = (GameObject)Singleton <CResourceManager> .GetInstance().GetResource(this.m_externalElementPrefabPath, typeof(GameObject), enResourceType.UIPrefab, false, false).m_content;

                    if (gameObject != null)
                    {
                        cUIListElementScript = gameObject.GetComponent <CUIListElementScript>();
                    }
                }
                if (cUIListElementScript != null && gameObject != null)
                {
                    cUIListElementScript.Initialize(formScript);
                    this.m_elementTemplate    = gameObject;
                    this.m_elementName        = gameObject.name;
                    this.m_elementDefaultSize = cUIListElementScript.m_defaultSize;
                }
            }
            else
            {
                cUIListElementScript = base.GetComponentInChildren <CUIListElementScript>(base.gameObject);
                if (cUIListElementScript != null)
                {
                    cUIListElementScript.Initialize(formScript);
                    this.m_elementTemplate    = cUIListElementScript.gameObject;
                    this.m_elementName        = cUIListElementScript.gameObject.name;
                    this.m_elementDefaultSize = cUIListElementScript.m_defaultSize;
                    if (this.m_elementTemplate != null)
                    {
                        this.m_elementTemplate.name = this.m_elementName + "_Template";
                    }
                }
            }
            if (this.m_elementTemplate != null)
            {
                CUIListElementScript component = this.m_elementTemplate.GetComponent <CUIListElementScript>();
                if (component != null && component.m_useSetActiveForDisplay)
                {
                    this.m_elementTemplate.CustomSetActive(false);
                }
                else
                {
                    if (!this.m_elementTemplate.activeSelf)
                    {
                        this.m_elementTemplate.SetActive(true);
                    }
                    CanvasGroup canvasGroup = this.m_elementTemplate.GetComponent <CanvasGroup>();
                    if (canvasGroup == null)
                    {
                        canvasGroup = this.m_elementTemplate.AddComponent <CanvasGroup>();
                    }
                    canvasGroup.alpha          = 0f;
                    canvasGroup.blocksRaycasts = false;
                }
            }
            if (this.m_content != null)
            {
                this.m_contentRectTransform                  = (this.m_content.transform as RectTransform);
                this.m_contentRectTransform.pivot            = new Vector2(0f, 1f);
                this.m_contentRectTransform.anchorMin        = new Vector2(0f, 1f);
                this.m_contentRectTransform.anchorMax        = new Vector2(0f, 1f);
                this.m_contentRectTransform.anchoredPosition = Vector2.zero;
                this.m_contentRectTransform.localRotation    = Quaternion.identity;
                this.m_contentRectTransform.localScale       = new Vector3(1f, 1f, 1f);
                this.m_lastContentPosition = this.m_contentRectTransform.anchoredPosition;
            }
            if (this.m_extraContent != null)
            {
                RectTransform rectTransform2 = this.m_extraContent.transform as RectTransform;
                rectTransform2.pivot            = new Vector2(0f, 1f);
                rectTransform2.anchorMin        = new Vector2(0f, 1f);
                rectTransform2.anchorMax        = new Vector2(0f, 1f);
                rectTransform2.anchoredPosition = Vector2.zero;
                rectTransform2.localRotation    = Quaternion.identity;
                rectTransform2.localScale       = Vector3.one;
                if (this.m_elementTemplate != null)
                {
                    rectTransform2.sizeDelta = new Vector2((this.m_elementTemplate.transform as RectTransform).rect.width, rectTransform2.sizeDelta.y);
                }
                if (rectTransform2.parent != null && this.m_content != null)
                {
                    rectTransform2.parent.SetParent(this.m_content.transform);
                }
                this.m_extraContent.SetActive(false);
            }
            this.m_isExtraContentEnabled = true;
            if (this.m_elementTemplate != null)
            {
                this.SetElementAmount(this.m_elementAmount);
            }
        }
Esempio n. 17
0
 protected virtual void OnDestroy()
 {
     this.m_belongedFormScript = null;
     this.m_belongedListScript = null;
     this.m_widgets            = null;
 }
Esempio n. 18
0
 public override void Initialize(CUIFormScript formScript)
 {
     this.form = formScript;
     base.Initialize(formScript);
     this.m_image = base.GetComponent <Image>();
 }
Esempio n. 19
0
        public override void Initialize(CUIFormScript formScript)
        {
            if (!base.m_isInitialized)
            {
                base.Initialize(formScript);
                this.m_selectedElementIndex     = -1;
                this.m_lastSelectedElementIndex = -1;
                this.m_scrollRect = base.GetComponentInChildren <ScrollRect>(base.gameObject);
                if (this.m_scrollRect != null)
                {
                    this.m_scrollRect.enabled = false;
                    RectTransform transform = this.m_scrollRect.transform as RectTransform;
                    this.m_scrollAreaSize = new Vector2(transform.rect.width, transform.rect.height);
                    this.m_content        = this.m_scrollRect.content.gameObject;
                }
                this.m_scrollBar = base.GetComponentInChildren <Scrollbar>(base.gameObject);
                if ((this.m_listType == enUIListType.Vertical) || (this.m_listType == enUIListType.VerticalGrid))
                {
                    if (this.m_scrollBar != null)
                    {
                        this.m_scrollBar.direction = Scrollbar.Direction.BottomToTop;
                    }
                    DebugHelper.Assert(this.m_scrollRect != null);
                    if (this.m_scrollRect != null)
                    {
                        this.m_scrollRect.horizontal          = false;
                        this.m_scrollRect.vertical            = true;
                        this.m_scrollRect.horizontalScrollbar = null;
                        this.m_scrollRect.verticalScrollbar   = this.m_scrollBar;
                    }
                }
                else if ((this.m_listType == enUIListType.Horizontal) || (this.m_listType == enUIListType.HorizontalGrid))
                {
                    if (this.m_scrollBar != null)
                    {
                        this.m_scrollBar.direction = Scrollbar.Direction.LeftToRight;
                    }
                    DebugHelper.Assert(this.m_scrollRect != null);
                    if (this.m_scrollRect != null)
                    {
                        this.m_scrollRect.horizontal          = true;
                        this.m_scrollRect.vertical            = false;
                        this.m_scrollRect.horizontalScrollbar = this.m_scrollBar;
                        this.m_scrollRect.verticalScrollbar   = null;
                    }
                }
                this.m_elementScripts       = new ListView <CUIListElementScript>();
                this.m_unUsedElementScripts = new ListView <CUIListElementScript>();
                if (this.m_useOptimized)
                {
                    this.m_elementsRect = new List <stRect>();
                }
                CUIListElementScript component = null;
                if (this.m_useExternalElement)
                {
                    GameObject content = (GameObject)Singleton <CResourceManager> .GetInstance().GetResource(this.m_externalElementPrefabPath, typeof(GameObject), enResourceType.UIPrefab, false, false).m_content;

                    component = content.GetComponent <CUIListElementScript>();
                    if (component != null)
                    {
                        component.Initialize(formScript);
                        this.m_elementTemplate    = content;
                        this.m_elementName        = content.name;
                        this.m_elementDefaultSize = component.m_defaultSize;
                    }
                }
                else
                {
                    component = base.GetComponentInChildren <CUIListElementScript>(base.gameObject);
                    if (component != null)
                    {
                        component.Initialize(formScript);
                        this.m_elementTemplate    = component.gameObject;
                        this.m_elementName        = component.gameObject.name;
                        this.m_elementDefaultSize = component.m_defaultSize;
                        if (this.m_elementTemplate != null)
                        {
                            this.m_elementTemplate.name = this.m_elementName + "_Template";
                        }
                    }
                }
                if (this.m_elementTemplate != null)
                {
                    CUIListElementScript script2 = this.m_elementTemplate.GetComponent <CUIListElementScript>();
                    if ((script2 != null) && script2.m_useSetActiveForDisplay)
                    {
                        this.m_elementTemplate.CustomSetActive(false);
                    }
                    else
                    {
                        if (!this.m_elementTemplate.activeSelf)
                        {
                            this.m_elementTemplate.SetActive(true);
                        }
                        CanvasGroup group = this.m_elementTemplate.GetComponent <CanvasGroup>();
                        if (group == null)
                        {
                            group = this.m_elementTemplate.AddComponent <CanvasGroup>();
                        }
                        group.alpha          = 0f;
                        group.blocksRaycasts = false;
                    }
                }
                if (this.m_content != null)
                {
                    this.m_contentRectTransform                  = this.m_content.transform as RectTransform;
                    this.m_contentRectTransform.pivot            = new Vector2(0f, 1f);
                    this.m_contentRectTransform.anchorMin        = new Vector2(0f, 1f);
                    this.m_contentRectTransform.anchorMax        = new Vector2(0f, 1f);
                    this.m_contentRectTransform.anchoredPosition = Vector2.zero;
                    this.m_contentRectTransform.localRotation    = Quaternion.identity;
                    this.m_contentRectTransform.localScale       = new Vector3(1f, 1f, 1f);
                    this.m_lastContentPosition = this.m_contentRectTransform.anchoredPosition;
                }
                if (this.m_extraContent != null)
                {
                    RectTransform transform2 = this.m_extraContent.transform as RectTransform;
                    transform2.pivot            = new Vector2(0f, 1f);
                    transform2.anchorMin        = new Vector2(0f, 1f);
                    transform2.anchorMax        = new Vector2(0f, 1f);
                    transform2.anchoredPosition = Vector2.zero;
                    transform2.localRotation    = Quaternion.identity;
                    transform2.localScale       = Vector3.one;
                    if (this.m_elementTemplate != null)
                    {
                        transform2.sizeDelta = new Vector2((this.m_elementTemplate.transform as RectTransform).rect.width, transform2.sizeDelta.y);
                    }
                    if ((transform2.parent != null) && (this.m_content != null))
                    {
                        transform2.parent.SetParent(this.m_content.transform);
                    }
                    this.m_extraContent.SetActive(false);
                }
                this.SetElementAmount(this.m_elementAmount);
            }
        }
Esempio n. 20
0
        public void OpenAwardTip(CUseable[] items, string title = null, bool playSound = false, enUIEventID eventID = 0, bool displayAll = false, bool forceNotGoToBag = false, string formPath = "Form_Award")
        {
            if (items != null)
            {
                int           b          = 10;
                int           amount     = Mathf.Min(items.Length, b);
                CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm("UGUI/Form/Common/" + formPath, false, true);

                if (formScript != null)
                {
                    formScript.transform.FindChild("btnGroup/Button_Back").GetComponent <CUIEventScript>().m_onClickEventID = eventID;
                    if (title != null)
                    {
                        Utility.GetComponetInChild <Text>(formScript.gameObject, "bg/Title").text = title;
                    }
                    CUIListScript component = formScript.transform.FindChild("IconContainer").gameObject.GetComponent <CUIListScript>();
                    component.SetElementAmount(amount);
                    for (int i = 0; i < amount; i++)
                    {
                        if ((component.GetElemenet(i) != null) && (items[i] != null))
                        {
                            GameObject gameObject = component.GetElemenet(i).gameObject;
                            CUICommonSystem.SetItemCell(formScript, gameObject, items[i], true, displayAll);
                            gameObject.CustomSetActive(true);
                            gameObject.transform.FindChild("ItemName").GetComponent <Text>().text = items[i].m_name;
                            if (playSound)
                            {
                                COM_REWARDS_TYPE mapRewardType = items[i].MapRewardType;
                                if (mapRewardType != COM_REWARDS_TYPE.COM_REWARDS_TYPE_COIN)
                                {
                                    if (mapRewardType == COM_REWARDS_TYPE.COM_REWARDS_TYPE_AP)
                                    {
                                        goto Label_0162;
                                    }
                                    if (mapRewardType == COM_REWARDS_TYPE.COM_REWARDS_TYPE_DIAMOND)
                                    {
                                        goto Label_014C;
                                    }
                                }
                                else
                                {
                                    Singleton <CSoundManager> .GetInstance().PostEvent("UI_hall_add_coin", null);
                                }
                            }
                        }
                        continue;
Label_014C:
                        Singleton <CSoundManager> .GetInstance().PostEvent("UI_hall_add_diamond", null);

                        continue;
Label_0162:
                        Singleton <CSoundManager> .GetInstance().PostEvent("UI_hall_add_physical_power", null);
                    }
                    CUIEventScript script3 = formScript.transform.Find("btnGroup/Button_Use").GetComponent <CUIEventScript>();
                    script3.gameObject.CustomSetActive(false);
                    if ((!forceNotGoToBag && (amount == 1)) && (items[0].m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP))
                    {
                        CItem item = items[0] as CItem;
                        if (((item.m_itemData.bType == 4) || (item.m_itemData.bType == 1)) || (item.m_itemData.bType == 11))
                        {
                            CUseable useableByBaseID = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().GetUseableContainer(enCONTAINER_TYPE.ITEM).GetUseableByBaseID(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, item.m_baseID);

                            if (useableByBaseID != null)
                            {
                                script3.gameObject.CustomSetActive(true);
                                script3.m_onClickEventParams.iconUseable = useableByBaseID;
                                script3.m_onClickEventParams.tag         = Mathf.Min(item.m_stackCount, useableByBaseID.m_stackCount);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 21
0
 public override void Initialize(CUIFormScript formScript)
 {
     base.Initialize(formScript);
 }
Esempio n. 22
0
 public static void SetSprite(this Image image, string prefabPath, CUIFormScript formScript, bool loadSync = true, bool needCached = false, bool unloadBelongedAssetBundleAfterLoaded = false)
 {
     CUIUtility.SetImageSprite(image, prefabPath, formScript, loadSync, needCached, unloadBelongedAssetBundleAfterLoaded);
 }
Esempio n. 23
0
        private void OpenMessageBoxBase(string strContent, bool isHaveCancelBtn, enUIEventID confirmID, enUIEventID cancelID, stUIEventParams par, bool isContentLeftAlign = false, string confirmStr = "", string cancelStr = "", string titleStr = "", int autoCloseTime = 0, enUIEventID timeUpID = 0)
        {
            CUIFormScript script = Singleton <CUIManager> .GetInstance().OpenForm("UGUI/Form/Common/Form_MessageBox.prefab", false, false);

            if (script != null)
            {
                GameObject gameObject = script.gameObject;
                if (gameObject != null)
                {
                    if (confirmStr == string.Empty)
                    {
                        confirmStr = Singleton <CTextManager> .GetInstance().GetText("Common_Confirm");
                    }
                    if (cancelStr == string.Empty)
                    {
                        cancelStr = Singleton <CTextManager> .GetInstance().GetText("Common_Cancel");
                    }
                    if (titleStr == string.Empty)
                    {
                        titleStr = Singleton <CTextManager> .GetInstance().GetText("Common_MsgBox_Title");
                    }
                    GameObject obj3 = gameObject.transform.Find("Panel/Panel/btnGroup/Button_Confirm").gameObject;
                    obj3.GetComponentInChildren <Text>().text = confirmStr;
                    GameObject obj4 = gameObject.transform.Find("Panel/Panel/btnGroup/Button_Cancel").gameObject;
                    obj4.GetComponentInChildren <Text>().text = cancelStr;
                    gameObject.transform.Find("Panel/Panel/title/Text").gameObject.GetComponentInChildren <Text>().text = titleStr;
                    Text component = gameObject.transform.Find("Panel/Panel/Text").GetComponent <Text>();
                    component.text = strContent;
                    if (!isHaveCancelBtn)
                    {
                        obj4.CustomSetActive(false);
                    }
                    else
                    {
                        obj4.CustomSetActive(true);
                    }
                    CUIEventScript script2 = obj3.GetComponent <CUIEventScript>();
                    CUIEventScript script3 = obj4.GetComponent <CUIEventScript>();
                    script2.SetUIEvent(enUIEventType.Click, confirmID, par);
                    script3.SetUIEvent(enUIEventType.Click, cancelID, par);
                    if (isContentLeftAlign)
                    {
                        component.alignment = TextAnchor.MiddleLeft;
                    }
                    if (autoCloseTime != 0)
                    {
                        Transform transform = script.transform.Find("closeTimer");
                        if (transform != null)
                        {
                            CUITimerScript script4 = transform.GetComponent <CUITimerScript>();
                            if (script4 != null)
                            {
                                script4.SetTotalTime((float)autoCloseTime);
                                script4.StartTimer();
                                script4.m_eventIDs[1]    = timeUpID;
                                script4.m_eventParams[1] = par;
                            }
                        }
                    }
                    this.CloseSendMsgAlert();
                }
            }
        }