示例#1
0
 public static void GetUI()
 {
     if (mGO == null)
     {
         return;
     }
     mSlider = ComTool.Find <Slider>(mGO, "Slider", UIName.UILoading);
     mText   = ComTool.Find <Text>(mGO, "Text", UIName.UILoading);
 }
示例#2
0
 public UILogin(GameObject go) : base(go)
 {
     mName     = UIName.UILogin;
     mAccounts = ComTool.Find <InputField>(mGo, "Accounts", mName);
     mPassword = ComTool.Find <InputField>(mGo, "Password", mName);
     mEnter    = ComTool.Find <Button>(mGo, "Enter", mName);
     mQuit     = ComTool.Find <Button>(mGo, "Quit", mName);
     MessageBox.Warning("UILogin初始化");
 }
示例#3
0
        /// <summary>
        /// 初始化
        /// </summary>
        public static void Init()
        {
            GameObject   go     = GameObject.FindWithTag(TagName.UICamera);
            Canvas       canvas = null;
            CanvasScaler scaler = null;

            if (go == null)
            {
                go                    = UITool.CreateCanvas("UIRoot");
                go.tag                = TagName.UICamera;
                canvas                = go.GetComponent <Canvas>();
                scaler                = go.GetComponent <CanvasScaler>();
                canvas.renderMode     = RenderMode.ScreenSpaceCamera;
                canvas.pixelPerfect   = false;
                canvas.planeDistance  = 0;
                canvas.sortingLayerID = 1 << LayerName.GetIndexOfLayerName(LayerName.Default);
                UICamera              = CreateCamera("UICamera", 1, go.transform);
                UIFXCamera            = CreateCamera("UIFXCamera", 2, go.transform);
                GameObject ui = new GameObject();
                ui.name             = "UI";
                ui.transform.parent = go.transform;
                UITrans             = ui.transform;
                GameObject fx = new GameObject();
                fx.name             = "FX";
                fx.transform.parent = go.transform;
                FXTrans             = fx.transform;
            }
            else
            {
                UICamera   = ComTool.Find <Camera>(go, "UICamera");
                UIFXCamera = ComTool.Find <Camera>(go, "UIFXCamera");
                UITrans    = TransTool.Find(go.transform, "UI");
                FXTrans    = TransTool.Find(go.transform, "FX");
            }
            if (go != null)
            {
                GameObject.DontDestroyOnLoad(go.transform);
                UIRoot = go;
            }

            /**
             * if (go == null)
             * {
             *  go = UITool.CreateCanvas("UIRoot");
             *  go.tag = TagName.UICamera;
             *  canvas = go.GetComponent<Canvas>();
             *  scaler = go.GetComponent<CanvasScaler>();
             *  canvas.renderMode = RenderMode.ScreenSpaceOverlay;
             *  canvas.pixelPerfect = false;
             *  canvas.sortingOrder = 0;
             *  scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
             *  scaler.referenceResolution = new Vector2(GameSetting.ScreenW, GameSetting.ScreenH);
             *  scaler.screenMatchMode = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight;
             *  scaler.matchWidthOrHeight = 1;
             * }
             *
             * Transform UILayerTrans = TransTool.Find(go.transform, "UILayer");
             * if (UILayerTrans == null) UILayer = UITool.CreateCanvas("UILayer", UIRoot.transform);
             * else UILayer = UILayerTrans.gameObject;
             * Transform TipLayerTrans = TransTool.Find(go.transform, "TipLayer");
             * if (TipLayerTrans == null) TipLayer = UITool.CreateCanvas("TipLayer", UIRoot.transform);
             * else TipLayer = UILayerTrans.gameObject;
             */
        }