123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
-
- using UnityEngine;
- using UnityEngine.UI;
- using System;
- using System.Collections.Generic;
- namespace SUIFW
- {
- public class BaseUIForms : MonoBehaviour
- {
-
-
- private UIType _CurrentUIType=new UIType();
-
-
-
-
- internal UIType CurrentUIType
- {
- set
- {
- _CurrentUIType = value;
- }
- get
- {
- return _CurrentUIType;
- }
- }
- #region 窗体生命周期
-
- public virtual void Display()
- {
- this.gameObject.SetActive(true);
- if (_CurrentUIType.UIForms_Type == UIFormsType.PopUp)
- {
-
- UIMaskMgr.GetInstance().SetMaskWindow(this.gameObject,_CurrentUIType.UIForms_LucencyType);
- }
- }
-
- public virtual void Hiding()
- {
- this.gameObject.SetActive(false);
- if (_CurrentUIType.UIForms_Type == UIFormsType.PopUp)
- {
-
- UIMaskMgr.GetInstance().CancleMaskWindow();
- }
- }
-
- public virtual void Redisplay()
- {
- this.gameObject.SetActive(true);
- if (_CurrentUIType.UIForms_Type == UIFormsType.PopUp)
- {
-
- UIMaskMgr.GetInstance().SetMaskWindow(this.gameObject, _CurrentUIType.UIForms_LucencyType);
- }
- }
-
- public virtual void Freeze()
- {
- this.gameObject.SetActive(true);
- }
- #endregion
- #region 给子类封装的方法
-
-
-
-
-
- protected void RigisteButtonObjectEvent(string strButtonName, EventTriggerListener.VoidDelegate delHandle)
- {
- GameObject goNeedRigistButton = UnityHelper.FindTheChild(this.gameObject, strButtonName).gameObject;
- EventTriggerListener.Get(goNeedRigistButton).onClick = delHandle;
- }
-
-
-
- protected void CloseOrReturnUIForms()
- {
- string strUIFomrsName = null;
- int intPosition = -1;
- strUIFomrsName = GetType().ToString();
- intPosition = strUIFomrsName.IndexOf('.');
- if (intPosition != -1)
- {
- strUIFomrsName = strUIFomrsName.Substring(intPosition + 1);
- }
- UIManager.GetInstance().CloseOrReturnUIForms(strUIFomrsName);
- }
-
-
-
-
- protected void ShowUIForms(string strUIFormsName)
- {
- UIManager.GetInstance().ShowUIForms(strUIFormsName);
- }
-
-
-
-
-
-
- protected void SendMessage(string strMsgType, string strSmallClassType, object objMsgContent)
- {
- KeyValuesUpdate kv = new KeyValuesUpdate(strSmallClassType, objMsgContent);
- MessageCenter.SendMessage(strMsgType, kv);
- }
-
-
-
-
- protected string Show(string info)
- {
- return LauguageMgr.GetInstance().ShowText(info);
- }
- #endregion
- public void ChangeBlue(Image image)
- {
- Color color = Color.white;
- color.r = 111/255f;
- color.g = 168/255f;
- color.b = 254/255f;
- color.a = 255/255f;
- image.color = color;
- }
- public void ChangeRed(Image image)
- {
- Color color = Color.white;
- color.r = 254 / 255f;
- color.g = 1 / 255f;
- color.b = 7 / 255f;
- color.a = 255 / 255f;
- image.color = color;
- }
- }
- }
|