Example #1
0
        private void BindDataGrid()
        {
            //使用viewModel.SelectedItem作为默认类型,也要求必须有此属性并且可以作为加载类型
            foreach (var item in this.viewModel.OperationObject.GetType().GetProperties())
            {
                var list = item.GetCustomAttributes(typeof(UIIsListShow), true); //获取是否显示

                if (list.Count() > 0)                                            //只添加有显示属性的列
                {
                    UIIsListShow s = list[0] as UIIsListShow;
                    if (s.IsListShow)
                    {
                        //获取属性的UI显示名称
                        var    l1     = item.GetCustomAttributes(typeof(UIName), true);
                        UIName p1     = l1.Count() > 0 ? l1[0] as UIName : null;
                        string uiName = p1 == null ? item.Name : p1.Name;//如果UI显示名称是空,则按照属性名称显示

                        //动态添加列
                        FirstFloor.ModernUI.Windows.Controls.DataGridTextColumn col = new FirstFloor.ModernUI.Windows.Controls.DataGridTextColumn();
                        col.Header = uiName;

                        Binding bd = new Binding(item.Name);
                        bd.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                        bd.Mode = BindingMode.TwoWay;

                        col.Binding = bd;

                        this.DG1.Columns.Add(col);
                    }
                }
            }
        }
Example #2
0
    public void ShowDialog(UIName dialogName, UIShowType showType = UIShowType.Normal)
    {
        AssignLayer(showType);
        GameObject dialogObject = null;

        if (m_rgCacheUIController != null)
        {
            if (m_rgCacheUIController.ContainsKey(dialogName))
            {
                dialogObject = m_rgCacheUIController[dialogName].gameObject;
            }
        }
        if (dialogObject == null)
        {
            string uiprefabpath = UIRegister.GetUIPath(dialogName);
            if (!string.IsNullOrEmpty(uiprefabpath))
            {
                GameObject uiprefab = Resources.Load <GameObject>(uiprefabpath);
                dialogObject = GameObject.Instantiate(uiprefab, Vector3.zero, Quaternion.identity, m_UILayers[m_iCurUILayer]);
                dialogObject.SetActive(false);
            }
        }
        UIController tmp = dialogObject.GetComponent <UIController>();

        if (tmp == null)
        {
            Debug.Log("UI Root Node Can Not Find UIController! UIName:  " + dialogName);
            return;
        }
        if (!m_rgCacheUIController.ContainsKey(dialogName))
        {
            m_rgCacheUIController.Add(dialogName, tmp);
        }
        OnShowDialog(tmp, showType);
    }
Example #3
0
        // -------------------------------------------------------------------------------------
        // Public Funtion
        public void ChangeUI(UIName _name, bool _force = false, Action _onCompleted = null)
        {
            if (_CurrentUI == _name || _IsChanging)
            {
                return;
            }

            // Set Event
            Action onCompleted = () =>
            {
                _IsChanging = false;
                _onCompleted?.Invoke();
            };
            Action showEvent = () =>
            {
                _CurrentUI = _name;
                _CanvanInfoDict[_CurrentUI].InitCanvas();
                Show(_CurrentUI, _force, onCompleted);
            };

            // Process
            _IsChanging = true;
            if (_CurrentUI != UIName.None)
            {
                Hide(_CurrentUI, _force, showEvent);
            }
            else
            {
                showEvent?.Invoke();
            }
        }
Example #4
0
 protected override void OnUpdate()
 {
     // only difference between toggle and button in dots runtime is the additional Toggleable component
     Entities.ForEach((RectTransform urc, Button button) =>
     {
         var e            = GetPrimaryEntity(button);
         var buttonColors = button.colors;
         DstEntityManager.AddComponentData(e, new Selectable
         {
             Graphic          = GetPrimaryEntity(button.targetGraphic),
             IsInteractable   = button.IsInteractable(),
             NormalColor      = buttonColors.normalColor.linear.ToTiny(),
             HighlightedColor = buttonColors.highlightedColor.linear.ToTiny(),
             PressedColor     = buttonColors.pressedColor.linear.ToTiny(),
             SelectedColor    = buttonColors.selectedColor.linear.ToTiny(),
             DisabledColor    = buttonColors.disabledColor.linear.ToTiny(),
         });
         var uiName = new UIName()
         {
             Name = button.name
         };
         DstEntityManager.AddComponentData(e, uiName);
         if (button.name.Length > uiName.Name.Capacity)
         {
             Debug.LogWarning($"UIName '{button.name}' is too long and is being truncated. It may not be found correctly at runtime.");
         }
         DstEntityManager.AddComponent <UIState>(e);
     });
 }
Example #5
0
    /// <summary>
    /// 获取一个UIView
    /// </summary>
    /// <param name="name">UI名</param>
    /// <returns>UIView</returns>
    public UIView GetView(UIName name)
    {
        UIView view;

        _viewMap.TryGetValue(name, out view);
        return(view);
    }
        public void ManagerMaskShow(UIBase ui)
        {
            switch (ui.maskType)
            {
            case UIMaskType.OnlyMask:
                SetAlpha();
                m_clickCloseUI = UIName.None;
                break;

            case UIMaskType.MaskClickClose:
                SetAlpha();
                m_clickCloseUI = ui.uiName;
                break;

            case UIMaskType.TransparentMask:
                SetTransparent();
                m_clickCloseUI = UIName.None;
                break;

            case UIMaskType.TransparentClickMask:
                SetTransparent();
                m_clickCloseUI = ui.uiName;
                break;
            }
            curMaskUIType = ui.uiType;
            SetSortOrder(ui.UICanvas.sortingOrder - 1);
            ResumeUI();
        }
Example #7
0
    void Start()
    {
        if (myTurtleData.baseAcceleration > 0)
        {
            gameObject.name = myTurtleData.name;
            myEndurance     = myTurtleData.baseEndurance;
            myAcceleration  = myTurtleData.baseAcceleration;
            mySurface       = myTurtleData.favoriteSurface;
        }
        else
        {
            myAcceleration = Random.Range(1, 4);
            myEndurance    = Random.Range(1, 4);
        }
        transform.localScale = new Vector3(1 + (myTurtleData.MyScaleX * 0.01f), 1 + (myTurtleData.MyScaleY * 0.01f), 1);
        RaceResultsColumn1   = "";
        RaceResultsColumn2   = "";
        RaceResultsColumn3   = "";
        RaceResultsColumn4   = "";
        idleCounter          = Random.Range(0, 15);
        usedMats             = "";

        HowManyTurtlesFinished = 0;
        RaceManagerScriptRef   = RaceManagerReference.GetComponent <RaceManager>();
        inRaceResultsText      = RaceManagerScriptRef.inRaceResultsGiuText;
        myAnimator             = gameObject.GetComponent <Animator> ();
        BaseSpeed       += Random.Range(-10, 10) * .01f;
        SpeedChangeTimer = SpeedChangeTickRate;
        oddsGui          = UIOdds.GetComponent <TextMeshProUGUI>();
        //TurtleNamer TurlteNamerScriptRef = RaceManagerReference.GetComponent<TurtleNamer>();
        //gameObject.name = TurlteNamerScriptRef.GiveNewRandomName();
        //gameObject.name = TurlteNamerScriptRef.PossibleNames[Random.Range(0,TurlteNamerScriptRef.PossibleNames.Length -1)];
        UIName.GetComponent <TextMeshProUGUI>().text = gameObject.name;
    }
        private UIConfig GetConfig(UIName uiName)
        {
            UIConfig config;

            m_dic.TryGetValue(uiName, out config);
            return(config);
        }
Example #9
0
 public IUIBase GetUI(UIName ui_name)
 {
     if (IsShow(ui_name))
     {
         return(m_ui_res_mgr.GetLoadedUI(ui_name));
     }
     return(null);
 }
Example #10
0
    /// <summary>
    /// 关闭一个UIView
    /// </summary>
    /// <param name="name">UI名</param>
    public void CloseView(UIName name)
    {
        var view = GetView(name);

        if (view != null)
        {
            CloseView(view);
        }
    }
Example #11
0
    /// <summary>
    /// 打开一个UIView
    /// </summary>
    /// <param name="name">UI名</param>
    public void OpenView(UIName name)
    {
        var view = GetView(name);

        if (view != null)
        {
            OpenView(view);
        }
    }
Example #12
0
 public void CloseWindow(UIName _uiName)
 {
     if (m_CurrentWindow != null && m_CurrentWindow.m_UIName == _uiName)
     {
         m_LastWindow = m_CurrentWindow.m_UIName;
         m_CurrentWindow.LeaveWindow();
         m_CurrentWindow = null;
     }
 }
        public string GetUIPath(UIName ui_name)
        {
            int i_ui_name = (int)ui_name;

            if (m_ui_name2register_info.ContainsKey(i_ui_name))
            {
                return(m_ui_name2register_info[i_ui_name].m_ui_path);
            }
            return("");
        }
        /// <summary>
        /// 关闭当前UI
        /// </summary>
        /// <param name="uiName"></param>
        public void CloseCurUI(UIName uiName)
        {
            var list = GetUIList(uiName);

            if (list != null)
            {
                list.CloseCurUI(uiName);
                ChangeShowMask();
            }
        }
        private UIListMgr GetUIList(UIName uiName)
        {
            var config = GetConfig(uiName);

            if (config == null)
            {
                return(null);
            }
            return(m_listMgr[config.uiType]);
        }
Example #16
0
        public void CallUIMethod(UIName ui_name, string method_name)
        {
            IUIBase ui = GetUI(ui_name);

            if (ui == null)
            {
                return;
            }
            ui.GameObject.SendMessage(method_name);
        }
Example #17
0
        public IUIBase GetLoadedUI(UIName ui_name)
        {
            KeyValuePair <GameObject, IUIBase> pair;

            if (m_loaded_prefab.TryGetValue((int)ui_name, out pair))
            {
                return(pair.Value);
            }
            return(null);
        }
        private bool IsExitUI(UIName uiName)
        {
            var list = GetUIList(uiName);

            if (list != null)
            {
                return(list.IsExitUI(uiName));
            }
            return(false);
        }
Example #19
0
        public void DestroyUI(UIName ui_name)
        {
            int i_ui_name = (int)ui_name;

            if (!m_loaded_prefab.ContainsKey(i_ui_name))
            {
                return;
            }
            m_loaded_prefab.Remove(i_ui_name);
            Debug.Log("UIPrefabMgr DestroyUI, " + UIRegister.UI_DIR + ui_name.ToString());
        }
Example #20
0
 private void Awake()
 {
     UIName = gameObject.name;
     canvas = GetComponent <Canvas>();
     //根据命名约束判断是否是CS逻辑界面,CS逻辑界面不绑定Lua脚本
     if (!UIName.EndsWith("_CS"))
     {
         BindLuaScript();
     }
     OnInit?.Invoke();
 }
Example #21
0
 public static string GetUIPath(UIName name)
 {
     if (m_UIPath == null)
     {
         return("");
     }
     if (m_UIPath.ContainsKey(name))
     {
         return(m_UIPath[name]);
     }
     return("");
 }
Example #22
0
        public IUIBase ForceGetUI(UIName ui_name, string ui_dir_path = "")
        {
            IUIBase ui = m_ui_res_mgr.GetLoadedUI(ui_name);

            if (ui == null)
            {
                m_ui_res_mgr.LoadUI(ui_name, null, ui_dir_path);
                ui = m_ui_res_mgr.GetLoadedUI(ui_name);
                HideUIAsync(ui);
            }
            return(ui);
        }
Example #23
0
        public GameObject GetObjectInAssetBundle(UIName ui_name, string obj_name)  // ui_name没用
        {
            KeyValuePair <GameObject, IUIBase> pair;

            if (m_loaded_prefab.TryGetValue((int)ui_name, out pair))
            {
                return(pair.Key);
            }
            else
            {
                return(Resources.Load(UIRegister.UI_DIR + obj_name, typeof(GameObject)) as GameObject);
            }
        }
Example #24
0
 public void CloseDialog(UIName closeDialog)
 {
     if (m_curUIController == null)
     {
         return;
     }
     m_curUIController.UnRegisterEvent();
     m_curUIController.OnLeaveUI();
     m_curUIController.transform.parent = m_cacheLayer;
     m_curUIController.gameObject.SetActive(false);
     m_rgDialogStack.Pop();
     m_curUIController = m_rgDialogStack.Peek();
 }
Example #25
0
 public void ChangUIByName(UIName ui_name)
 {
     if (DictUI.ContainsKey(ui_name))
     {
         DictUI [_CurrentUI].HideUI();
         DictUI [ui_name].ShowUI();
         _CurrentUI = ui_name;
     }
     else
     {
         Debug.LogError(ui_name + " doesnt exist!?");
     }
 }
Example #26
0
 private void FadeUI(UIName _name, bool _force, Action _onCompleted, float _alpha)
 {
     if (_force)
     {
         _CanvanInfoDict[_name].Canvas.SetAlpha(_alpha);
         _onCompleted?.Invoke();
     }
     else
     {
         _Disposable?.Dispose();
         _Disposable = _CanvanInfoDict[_name].Canvas.LerpAlpha(DURATION_FADE_TRANSITION, _alpha, true, _onCompleted);
     }
 }
Example #27
0
 public UIBase ShowPopUI(UIName name)
 {
     foreach (UIBase item in uiList)
     {
         if (item.UIName == name)
         {
             SetNotOperate();
             item.ShowUI();
             PopUIStack.Push(item);
             return(item);
         }
     }
     return(null);
 }
Example #28
0
    public void ShowWindow(UIName _uiName, object o)
    {
        if (m_CurrentWindow != null)
        {
            m_LastWindow = m_CurrentWindow.m_UIName;
            m_CurrentWindow.LeaveWindow();
        }

        string kPath = GameManager.m_PathManager.ReturnPath(ResourcsePath.Prefab, PrefabPath.Window);

        m_Window        = Instantiate <GameObject>(Resources.Load <GameObject>(kPath + _uiName.ToString()), GetCanvas().transform);
        m_CurrentWindow = m_Window.GetComponent <UIWindow>();
        m_CurrentWindow.EnterWindow(o);
    }
Example #29
0
        bool ShowLoadedUI(UIName ui_name, object data = null)
        {
            IUIBase ui_base = m_ui_res_mgr.GetLoadedUI(ui_name);

            if (ui_base != null)
            {
                ShowUIAsync(ui_base, data);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #30
0
        bool HideLoadedUI(UIName ui_name)
        {
            IUIBase ui_base = m_ui_res_mgr.GetLoadedUI(ui_name);

            if (ui_base != null)
            {
                HideUIAsync(ui_base);
                return(true);
            }
            else
            {
                return(false);
            }
        }
	// Use this for initialization
	void Start () {

		//MapCameraControl.main = this;
		//mainCamera = this.transform.FindChild("PrimaryRotator").FindChild("Main Camera");
		centralCube = GameObject.Find("CentralCube").transform;//this.transform.FindChild("CentralCube");


		mapMaker = this.gameObject.GetComponent("MapMaker") as MapMaker;
		elasticConnection = this.gameObject.GetComponent<ElasticConnection>();

		//regularRotation = new Vector3(0f, 65f, 270f);
		/*regularRotation = mainCamera.localRotation.eulerAngles;
		regularRotationM = transform.localRotation.eulerAngles;
		birdsRotation = new Vector3(0f, 0f, 0f);
		birdsRotationM = new Vector3(0f, 0f, 0f);

		postPos = new Vector3(126,126,-240);
		postPosM = new Vector3(0,0,0);*/

		activeScreen = UIName.Landing;
		initUI();
		MapMaker.ActiveFloor = MapMaker.floors[0];
	}
	void hideScreen(UIName id){
		PowerUI.UI.document.getElementById(id.ToString()).style.display = "none";
	}
	void showScreen(UIName id){
		PowerUI.UI.document.getElementById(id.ToString()).style.display = "block";
	}