示例#1
0
 // Start is called before the first frame update
 void Start()
 {
     totalTime  = seconds;
     oldSeconds = 0f;
     timerText  = GetComponentInChildren <Text>();
     isClear    = false;
     act        = obj.GetComponent <PanelAction>();
 }
        public bool ExecuteAction(int action, bool modelIsValid, object extraData)
        {
            bool        processed   = false;
            PanelAction panelAction = (PanelAction)action;
            int         panelIndex  = Convert.ToInt32((string)extraData);

            switch (panelAction)
            {
            case PanelAction.Apply:
                if (modelIsValid)
                {
                    processed = true;
                }
                break;

            case PanelAction.Insert:
                if (modelIsValid)
                {
                    InsertPanel(panelIndex);
                    processed = true;
                }
                break;

            case PanelAction.Add:
                if (modelIsValid)
                {
                    AddPanel(panelIndex);
                    processed = true;
                }
                break;

            case PanelAction.Remove:
                RemovePanel(panelIndex);
                processed = true;
                break;

            case PanelAction.MoveLeft:
                if (modelIsValid)
                {
                    MovePanelLeft(panelIndex);
                    processed = true;
                }
                break;

            case PanelAction.MoveRight:
                if (modelIsValid)
                {
                    MovePanelRight(panelIndex);
                    processed = true;
                }
                break;

            default:
                throw new InternalError("Invalid action {0}", panelAction);
            }
            _ActiveTab = Math.Min(Panels.Count - 1, Math.Max(0, _ActiveTab));
            return(processed);
        }
示例#3
0
 private void SetPanels(PanelAction action = PanelAction.HIDE)
 {
     _panelMessage.Action    = action;
     _panelMessage.PanelName = PanelNames.UnitEditPanel;
     GameMessage.Send(_panelMessage);
     _panelMessage.PanelName = PanelNames.CompoundInventoryPanel;
     GameMessage.Send(_panelMessage);
     if (action == PanelAction.HIDE)
     {
         _panelMessage.PanelName = PanelNames.CompoundsPanel;
         GameMessage.Send(_panelMessage);
     }
 }
示例#4
0
    private void OnGUI()
    {
        if (GUILayout.Button("Open:MainPanel"))
        {
            var dic = new Dictionary <string, object>();
            dic["title"]       = "我是主面板";
            dic["info"]        = "当传入IDictionary时,会自动填充绑定好的字段或属性";
            dic["method"]      = "可以向方法传递一个参数";
            dic["ondestroy"]   = new Action <string>((x) => { Debug.Log(x); });
            dic["OpenPanel01"] = dic["OpenPanel02"] = dic["OpenPanel03"] = new PanelAction <Button>((context, button) => {
                Debug.Log(button + ": onClicked");
            });


            uiFacade.Open(PanelNames.MainPanel, dic);
        }
        if (GUILayout.Button("Open:MainPanel with viewModel"))
        {
            uiFacade.Open(PanelNames.MainPanel, mainViewModel);
        }
        if (GUILayout.Button("Open:MainPanel with viewModel with id"))
        {
            uiFacade.Open(PanelNames.MainPanel, mainViewModel_withID);
        }
        for (int i = 0; i < 2; i++)
        {
            if (GUILayout.Button("Open:Panel01  " + i))
            {
                OpenPanel01(i);
            }
        }
        if (GUILayout.Button("Close " + pane01))
        {
            uiFacade.Close(pane01);
        }
        if (GUILayout.Button("Hide " + pane01))
        {
            uiFacade.Hide(pane01);
        }
    }
 public C_Slider(PanelAction <UnityEngine.UI.Slider> panelAction) : base(panelAction)
 {
 }
 public C_Button(PanelAction <UnityEngine.UI.Button> panelAction) : base(panelAction)
 {
 }
示例#7
0
 public MenuPanel(Vector2i relativePosition, Vector2i componentSize, FloatRect bounds, float borderSize, PanelAction closePanelAction, Color panelColor)
 {
     this.size             = componentSize;
     this.position         = relativePosition;
     this.ClosePanelAction = closePanelAction;
     collisionBox          = new BoundingBox(this.size);
     panelState            = PanelState.Normal;
     vertexArray           = CreateMenuGraphicArrayWithBorder(bounds, borderSize, panelColor);
 }
示例#8
0
 public PanelMessage(PanelAction action, string panelName = "")
 {
     Action    = action;
     PanelName = panelName;
 }