public void OpenSmallMessageBox(string strContent, bool isHaveCancelBtn, enUIEventID confirmID, enUIEventID cancelID, stUIEventParams par, int autoCloseTime = 0, enUIEventID closeTimeID = 0, string confirmStr = "", string cancelStr = "", bool isContentLeftAlign = false) { CUIFormScript script = Singleton <CUIManager> .GetInstance().OpenForm("UGUI/Form/Common/Form_SmallMessageBox.prefab", false, false); if (script != null) { GameObject gameObject = script.gameObject; if (gameObject != null) { if (string.IsNullOrEmpty(confirmStr)) { confirmStr = Singleton <CTextManager> .GetInstance().GetText("Common_Confirm"); } if (string.IsNullOrEmpty(cancelStr)) { cancelStr = Singleton <CTextManager> .GetInstance().GetText("Common_Cancel"); } 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; 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) { if (closeTimeID > enUIEventID.None) { script4.m_eventIDs[1] = closeTimeID; } script4.SetTotalTime((float)autoCloseTime); script4.StartTimer(); } } } this.CloseSendMsgAlert(); } } }
public override void Initialize(CUIFormScript formScript) { if (this.m_isInitialized) { return; } base.Initialize(formScript); this.m_image = base.gameObject.GetComponent <Image>(); if (this.m_image != null) { this.m_defaultSprite = this.m_image.get_sprite(); this.m_defaultColor = this.m_image.get_color(); if (this.m_image is Image2) { Image2 image = this.m_image as Image2; this.m_defaultLayout = image.alphaTexLayout; } } if (this.m_autoAddUIEventScript) { CUIEventScript cUIEventScript = base.gameObject.GetComponent <CUIEventScript>(); if (cUIEventScript == null) { cUIEventScript = base.gameObject.AddComponent <CUIEventScript>(); 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.get_color(); } }
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); } }
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); } } } } } }