示例#1
0
        /// <summary>
        /// 获取一个层
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public Transform GetLayer(UILayer type)
        {
            Transform layer = null;

            mlayers.TryGetValue(type, out layer);
            return(layer);
        }
示例#2
0
    /// <summary>
    /// Parent-UI退出
    /// </summary>
    /// <param name="u"></param>
    /// <returns></returns>
    IEnumerator P_DoExitAnimator([NotNull] UILayer u)
    {
        if (u == null)
        {
            throw new ArgumentNullException("u");
        }
        u.Refresh();
        var images = u.UiImageList;
        var words  = u.UiWordList;

        foreach (var i in words)
        {
            i.DOFade(1, app.model.ui.ExitTime).SetEase(Ease.OutExpo);
        }

        u.UiCanvas.transform.localScale = new Vector3(app.model.ui.ExitScale, app.model.ui.ExitScale, app.model.ui.ExitScale);

        u.UiCanvas.transform.DOScale(app.model.ui.EnterScale, app.model.ui.ExitTime).SetEase(Ease.OutExpo);

        foreach (var i in images)
        {
            i.DOFade(1, app.model.ui.ExitTime).SetEase(Ease.OutExpo);
        }

        yield return(null);
    }
    public virtual void Start()
    {
        this.name = this.name.Replace("(Clone)", "");

        if (exporter == null)
        {
            string   scriptName = name + "View";
            object[] obj        = Lua.Call(scriptName, param);
            LuaController = obj[0] as LuaTable;
        }
        else
        {
            LuaController = exporter.InitLuaController(param);
            LuaController["gameObject"] = this.gameObject;
            LuaController["transform"]  = transform;
        }

        LuaController["this"] = this;

        UILayer layer = this.GetComponent <UILayer>();

        if (layer != null)
        {
            LuaController["layer"] = layer;
        }

        updateFunc = LuaController["Update"] as LuaFunction;
        CallLuaMethod("Start", this, gameObject);
    }
示例#4
0
    static int GetLayer(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <UILayer>(L, 2))
            {
                UIManager             obj  = (UIManager)ToLua.CheckObject <UIManager>(L, 1);
                UILayer               arg0 = (UILayer)ToLua.ToObject(L, 2);
                UnityEngine.Transform o    = obj.GetLayer(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <int>(L, 2))
            {
                UIManager             obj  = (UIManager)ToLua.CheckObject <UIManager>(L, 1);
                int                   arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                UnityEngine.Transform o    = obj.GetLayer(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UIManager.GetLayer"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
        //////////////////////////////////////////////////////////////////
        // Successful Sent Layer
        //////////////////////////////////////////////////////////////////

        public void OnSwitchToSuccessLayer()
        {
            StomtConfig.UserAmountStomts += 1;
            UpdateDynamicText();
            PlayShowAnimation(ArrowFindStomt.GetComponent <Animator>(), 0.5f);
            CurrentLayer = UILayer.Success;
        }
示例#6
0
        public void OnBuildModuleClick(int moduleId)   // Set from editor
        {
            if (selectedTitan == null)
            {
                return;
            }
            if (selectedTitan.Titan.Faction.ID == 1)
            {
                return;
            }
            if (selectedTitan.Titan.ModuleSlots.Length <= moduleId || selectedTitan.Titan.ModuleSlots[moduleId] == null)
            {
                return;
            }
            selectedSlot = selectedTitan.Titan.ModuleSlots[moduleId];
            var selectModule = UILayer.ShowModal <SelectModuleUI>();

            selectModule.Init(modules[moduleId].RectTransform.anchoredPosition + new Vector2(0, 800), selectedSlot);
            // var module = new ModuleData("laser", 5, 2f);
            // selectedSlot.Attach(Model.ModulesFactory.CreateBuildModule(module, selectedSlot));
            // UpdateModules();

            // FullScreenHolder.gameObject.SetActive(true);
            // BuildContextMenu.gameObject.SetActive(true);
            // BuildContextMenu.position = modules[moduleId].transform.position;
        }
    // instantiate a new UI object with a given prefab id, onto a specified layer
    public UIObject CreateNewUIObject(string uiPrefabId, UILayerId layerId)
    {
        if (_activeUI.ContainsKey(uiPrefabId))
        {
            CustomLogger.Error(nameof(UIManager), $"Already contains active UI with prefab Id {uiPrefabId}!");
            return(null);
        }
        if (!_uiLayers.TryGetValue(layerId, out UILayer layer))
        {
            CustomLogger.Error(nameof(UIManager), $"Layer Id {layerId} not found!");
            return(null);
        }
        GameObject obj = AssetManager.Instance.GetAsset(uiPrefabId);

        if (obj == null)
        {
            CustomLogger.Error(nameof(UIManager), $"Could not retrieve prefab for id {uiPrefabId}!");
            return(null);
        }
        UIObject uiObject = obj.GetComponent <UIObject>();

        if (uiObject == null)
        {
            CustomLogger.Error(nameof(UIManager), $"Prefab {uiPrefabId} did not contain type {nameof(UIObject)}!");
            return(null);
        }
        UILayer       parent            = _uiLayers[layerId];
        UIObject      instancedUIObject = Instantiate(uiObject, _uiLayers[layerId].transform);
        UIObjectEntry newEntry          = new UIObjectEntry(layerId, instancedUIObject);

        _activeUI.Add(uiPrefabId, newEntry);
        CustomLogger.Log(nameof(UIManager), $"Creating ui object with prefab id {uiPrefabId}");
        return(instancedUIObject);
    }
示例#8
0
    /// <summary>
    /// Parent-UI显示
    /// </summary>
    /// <returns></returns>
    IEnumerator P_DoAnimator([NotNull] UILayer u)
    {
        if (u == null)
        {
            throw new ArgumentNullException("u");
        }


        u.Refresh();
        var images = u.UiImageList;
        var words  = u.UiWordList;



        foreach (var i in words)
        {
            i.DOFade(0, app.model.ui.EnterTime).SetEase(Ease.OutExpo);
        }

        u.UiCanvas.transform.localScale = new Vector3(app.model.ui.EnterTime, app.model.ui.EnterTime, app.model.ui.EnterTime);
        u.UiCanvas.transform.DOScale(app.model.ui.InitScale, app.model.ui.EnterTime).SetEase(Ease.OutExpo);


        foreach (var i in images)
        {
            i.DOFade(0, app.model.ui.EnterTime).SetEase(Ease.OutExpo);
        }


        yield return(new WaitForSeconds(app.model.ui.EnterTime));

        u.UiState = false;
        app.model.ui.IsAnimator = false;
    }
        public static void RunApplication(SpreadApplication app)
        {
            startTime = DateTime.Now;

            float lastFrameTime = GetTime();


            while (WindowLayer.ShouldRender(app.ctx))
            {
                WindowLayer.EnterRenderLoop(app.ctx);

                InternalRunners <HookUpdateAttribute>(app);
                app.Update();

                UILayer.EnterUIFrame();
                app.DrawUI();
                UILayer.ExitUIFrame();

                WindowLayer.ExitRenderLoop(app.ctx);

                app.time      = GetTime();
                app.deltaTime = GetTime() - lastFrameTime;
                lastFrameTime = GetTime();
            }
        }
示例#10
0
    /// <summary>
    /// 创建队伍
    /// </summary>
    private Team CreateTeam()
    {
        if (Field == null)
        {
            return(null);
        }

        Formation f = CreateForamtion(_Formations [_FormationID].Value);

        if (f == null)
        {
            return(null);
        }

        GameObject go   = new GameObject();
        Team       team = go.AddComponent <Team> ();

        team.name = _TeamID.ToString();
        team.Formation.Copy(f);
        UILayer.AddChild(Field, team);

        for (int i = 0; i < f.Count; i++)
        {
            GameObject child = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            Unit       unit  = child.AddComponent <Unit> ();
            unit.Initialize();
            child.transform.position = f.GetPoint(i);
            UILayer.AddChild(team, unit);
        }

        return(team);
    }
示例#11
0
        public static async ETTask <UI> Create(this UIComponent self, string uiType, UILayer uiLayer)
        {
            UI ui = await UIEventComponent.Instance.OnCreate(self, uiType, uiLayer);

            self.UIs.Add(uiType, ui);
            return(ui);
        }
示例#12
0
        public static GameObject LoadPanel(string panelName, UILayer layer)
        {
            GameObject panelPrefab = Resources.Load <GameObject>(panelName);
            GameObject panel       = Instantiate(panelPrefab);

            panel.name = panelName;

            m_PanelsDict.Add(panel.name, panel);

            //设置Panel显示层级
            switch (layer)
            {
            case UILayer.Bg:
                panel.transform.SetParent(UIRoot.transform.Find("Bg"));
                break;

            case UILayer.Common:
                panel.transform.SetParent(UIRoot.transform.Find("Common"));
                break;

            case UILayer.Top:
                panel.transform.SetParent(UIRoot.transform.Find("Top"));
                break;
            }

            RectTransform panelRectTrans = panel.transform as RectTransform;

            panelRectTrans.offsetMin          = Vector2.zero;
            panelRectTrans.offsetMax          = Vector2.zero;
            panelRectTrans.anchoredPosition3D = Vector3.zero;
            panelRectTrans.anchorMin          = Vector2.zero;
            panelRectTrans.anchorMax          = Vector2.one;

            return(panel);
        }
示例#13
0
 private void ShowPanelBaseInfo()
 {
     GUILayout.Label("UI层级");
     uiLayer = (UILayer)EditorGUILayout.EnumPopup(uiLayer);
     GUILayout.Label("显示方式");
     activeType = (ActiveType)EditorGUILayout.EnumPopup(activeType);
 }
        public void OnPostButtonPressed()
        {
            if (IsErrorState)
            {
                this.HideErrorMessage();
                return;
            }

            if (!IsMessageLengthCorrect())
            {
                this.ShowErrorMessage(_api.lang.getString("SDK_STOMT_ERROR_MORE_TEXT"));
                return;
            }

            // Switch UI Layer
            _LayerInput.SetActive(false);
            if (StomtConfig.Subscribed)
            {
                _LayerSuccessfulSent.SetActive(true);
                CurrentLayer = UILayer.Success;
                OnSwitchToSuccessLayer();
            }
            else
            {
                _LayerSubscription.SetActive(true);
                CurrentLayer = UILayer.Subscription;
                _EmailInput.ActivateInputField();
                _EmailInput.Select();
                SubscribtionInfoText.GetComponent <Animator>().SetBool("Show", true);
            }

            // Submit
            this.handleStomtSending();
        }
        // FIXME: Make this private and use special function on success layer create new stomt
        public void ResetUILayers()
        {
            ResetInputForm();

            _ui.SetActive(true);
            _closeButton.SetActive(ShowCloseButton);

            this._LayerInput.SetActive(true);
            this._LayerSuccessfulSent.SetActive(false);

            // Reset Subscription Layer
            this._LayerSubscription.SetActive(false);
            _EmailInput.text = "";

            // Reset Login Layer

            this._LayerLogin.SetActive(false);

            // Reset Login Message Layer

            this._LayerLoginMessage.SetActive(false);

            // Handle Animations
            _characterLimit.GetComponent <Animator>().SetBool("Active", false);
            _like.GetComponent <Animator>().SetBool("OnTop", false);
            _wish.GetComponent <Animator>().SetBool("OnTop", true);

            CurrentLayer = UILayer.Input;
        }
示例#16
0
        public T Open <T>(
            int context           = 0,
            GameObject parent     = null,
            UILayer uiLayer       = UILayer.Common,
            Vector3 localPosition = new Vector3(),
            bool isFullScreen     = true,
            bool openImmediately  = true
            ) where T : UIBaseController, new()
        {
            string controllerId = UITools.GetControllerKey <T>(context);
            T      controller   = FindUIController(controllerId) as T;

            if (controller == null)
            {
                controller = CreateUIController <T>(context, parent, uiLayer, localPosition, isFullScreen);
            }

            if (controller != null)
            {
                controller.Init();
                if (openImmediately)
                {
                    controller.Open();
                }
            }
            return(controller);
        }
示例#17
0
        /// <summary>
        /// Create the UIView if not been created and show.
        /// </summary>
        public static UIView Open(Type t, UILayer layer = UILayer.BaseLayer, object data = null, bool beForced = true)
        {
            if (_uiRoot == null)
            {
                return(null);
            }

            var layerRectTransform = GetLayerRectTransform(layer);

            UIView uiView;

            _openedUIDict.TryGetValue(t, out uiView);

            if (uiView == null)
            {
                uiView = ViewManager.CreateView(t, layerRectTransform, data) as UIView;
                // TODO:
                //if (uiView is IRender) {
                //    Debug.LogException(new Exception("IRender 不能通过ViewManager创建"));
                //    return null;
                //}
            }
            else if (beForced)
            {
                uiView.Init(layerRectTransform, data);
            }

            uiView.UILayer = layer;

            _openedUIDict[uiView.GetType()] = uiView;

            return(uiView);
        }
示例#18
0
        private Camera _CreateUICamera(UILayer layer)
        {
            GameObject newCamera = new GameObject("UICamera_" + layer);

            newCamera.transform.parent = _uiCameraRoot.transform;
            Camera camera = newCamera.AddComponent <Camera>();

            int depth = (int)layer - (int)UILayer.UIMin;

            newCamera.layer = (int)layer;
            newCamera.SetActive(false);

            camera.clearFlags          = CameraClearFlags.Depth;
            camera.cullingMask         = 1 << (int)layer;
            camera.orthographic        = true;
            camera.orthographicSize    = 3.2f;
            camera.nearClipPlane       = 0;
            camera.farClipPlane        = 1000;
            camera.rect                = new Rect(0, 0, 1, 1);
            camera.depth               = depth;
            camera.renderingPath       = RenderingPath.VertexLit;
            camera.targetTexture       = null;
            camera.useOcclusionCulling = true;
            camera.hdr = false;

            return(camera);
        }
示例#19
0
        /// <summary>
        /// 创建层
        /// </summary>
        /// <param name="layer"></param>
        /// <returns></returns>
        Transform CreateLayer(UILayer layerType, UILayerLayout layout = UILayerLayout.Stretch)
        {
            string     layerName = layerType.ToString() + "_Layer";
            GameObject layer     = new GameObject(layerName);

            layer.layer = LayerMask.NameToLayer("UI");
            layer.transform.SetParent(io.uiCanvas.transform);
            layer.transform.localScale = Vector3.one;

            var rect = layer.AddComponent <RectTransform>();

            rect.anchorMin = Vector2.zero;
            switch (layout)
            {
            case UILayerLayout.Stretch:
                rect.anchorMax = Vector2.one;
                rect.sizeDelta = Vector2.zero;
                break;

            case UILayerLayout.LeftBottom:
                rect.anchorMax = Vector2.zero;
                rect.sizeDelta = new Vector2(1136, 640);
                break;
            }
            rect.anchoredPosition3D = Vector3.zero;
            rect.SetSiblingIndex((int)layerType);

            return(layer.transform);
        }
示例#20
0
    private void setLayer(ViewBase view, UILayer layer)
    {
        if (view == null)
        {
            return;
        }

        if (layer == UILayer.Common && commonLayer != null)
        {
            view.transform.SetParent(commonLayer, false);
        }
        else if (layer == UILayer.Top && topLayer != null)
        {
            view.transform.SetParent(topLayer, false);
        }
        else if (layer == UILayer.Bottom && bottomLayer != null)
        {
            view.transform.SetParent(bottomLayer, false);
        }

        var parent = view.transform.parent;

        if (parent != null)
        {
            view.rectTransform.SetSiblingIndex(parent.childCount);
        }
    }
示例#21
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            Effect vitaboyEffect = null;

            try
            {
                GameFacade.MainFont = new FSO.Client.UI.Framework.Font();
                GameFacade.MainFont.AddSize(10, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_10px"));
                GameFacade.MainFont.AddSize(12, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_12px"));
                GameFacade.MainFont.AddSize(14, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_14px"));
                GameFacade.MainFont.AddSize(16, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_16px"));

                GameFacade.EdithFont = new FSO.Client.UI.Framework.Font();
                GameFacade.EdithFont.AddSize(12, Content.Load <SpriteFont>("Fonts/Trebuchet_12px"));
                GameFacade.EdithFont.AddSize(14, Content.Load <SpriteFont>("Fonts/Trebuchet_14px"));

                vitaboyEffect = GameFacade.Game.Content.Load <Effect>("Effects/Vitaboy");
                uiLayer       = new UILayer(this, Content.Load <SpriteFont>("Fonts/ProjectDollhouse_12px"), Content.Load <SpriteFont>("Fonts/ProjectDollhouse_16px"));
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show("Content could not be loaded. Make sure that the Project Dollhouse content has been compiled! (ContentSrc/TSOClientContent.mgcb)");
                Exit();
            }

            FSO.Vitaboy.Avatar.setVitaboyEffect(vitaboyEffect);
        }
示例#22
0
	protected virtual void BuildItems() {
		_uiLayerObj = new GameObject ("UILayer_" + _layerName);
		_uiLayerObj.transform.SetParent (_parentObj.transform, false);
		_uiLayer = _uiLayerObj.AddComponent<UILayer> ();
		_uiLayer.Build (_sSettings);
		_uiLayer.AppearLayer(_curLevel-_prevLevel);

	}
示例#23
0
 public void pop(UILayer layer)
 {
     if(layer == null)
     {
         MDDebug.LogError("layer is null");
         return;
     }
     layerList.Remove(layer);
     layer.destroy();
 }
示例#24
0
文件: UIManager.cs 项目: xqy/game
 /// <summary>
 /// 获取层容器
 /// </summary>
 /// <param name="layer"></param>
 /// <returns></returns>
 public Transform getUILayer(UILayer layer)
 {
     return layerList[(int)layer];
 }