示例#1
0
        private void OnTriggerEnterHandler(MyEvent.MyEvent myevent)
        {
            var obj = (myevent as MyTriggerEvent).data as GameObject;
//            Debug.Log("enter " + obj.name);
            var sc = obj.GetComponent <FieldObjWithCircle>();

            if (IgnoreTrigger(sc))
            {
                return;
            }
            if (this.touchObjList.Contains(sc))
            {
                Debug.LogError("???");
            }
            else
            {
                this.touchObjList.Add(sc);
                if (this.touchObjList.Count == 1)
                {
                    SelectObject(0);
                }
                else
                {
                    sc.SetCircleState(FieldObjWithCircle.CircleState.Touched);
                }
            }
        }
示例#2
0
        private void OnTriggerExitHandler(MyEvent.MyEvent myevent)
        {
            var obj = (myevent as MyTriggerEvent).data as GameObject;
//            Debug.Log("enter " + obj.name);
            var sc = obj.GetComponent <FieldObjWithCircle>();

            if (IgnoreTrigger(sc))
            {
                return;
            }
            var index = this.touchObjList.IndexOf(sc);

            if (index >= 0)
            {
                sc.SetCircleState(FieldObjWithCircle.CircleState.None);
                this.touchObjList.RemoveAt(index);
                if (index == this.currSelectObject)
                {
                    SelectObject(index);
                }
            }
            else
            {
                Debug.LogError("???");
            }
        }
示例#3
0
        private void OnClickCardHandler(MyEvent.MyEvent evt)
        {
            var card = evt.data as CardComponent;

            if (card == null)
            {
                Debug.LogError("???");
                return;
            }
            var c = card.cardData;

            if (currentPlayer == 0)
            {
                if (handManager.GetHandCardList().Contains(c))
                {
                    //click hand card
                    if (handManager.CanPlayCard())
                    {
                        PlayCard(c);
                    }
                }
//                else if (ShowDebug && yamaManager.GetYamaCardList().Contains(c) && handManager.CanDrawCard())
//                {
//                    //click yama card
//                    currentCard = c;
//                    yamaManager.DebugDraw(c);
//                    handManager.AddCard(c);
//                    uiManager.DebugYama(yamaManager.GetYamaCardList());
//                    uiManager.ShowDrawCard(c);
//                    UpdateDebugUI();
//                }
            }
        }
示例#4
0
        private void OnKeyDownHandler(MyEvent.MyEvent obj)
        {
            var key = obj.data.ToString();

            if (key == KeyControl.ESC)
            {
                if (this.currUIWindow == null)
                {
                    uiBottomMenu.Switch();
                }
                else
                {
                    CloseUI();
                }
                return;
            }
            if (this.currUIWindow != null && key == KeyControl.RIGHT)
            {
                CloseUI();
                return;
            }
            if (strToType.ContainsKey(key))
            {
                var openType = strToType[key];
                if (currUIType != openType)
                {
                    OpenUI(openType);
                }
                else
                {
                    CloseUI();
                }
            }
        }
示例#5
0
        private void OnKeyDownHandler(MyEvent.MyEvent obj)
        {
            var key = obj.data.ToString();

//            Debug.Log("key down " + key);
            switch (key)
            {
            case KeyControl.UP:
                InputDir[1]    = 1;
                this.changeDir = true;
                break;

            case KeyControl.DOWN:
                InputDir[1]    = -1;
                this.changeDir = true;
                break;

            case KeyControl.LEFT:
                InputDir[0]    = -1;
                this.changeDir = true;
                break;

            case KeyControl.RIGHT:
                InputDir[0]    = 1;
                this.changeDir = true;
                break;

            case KeyControl.INTERACT:
                if (currSelectObject >= 0)
                {
                    if (CanInteract())
                    {
                        StartInteract();
                    }
                }
                break;

            case KeyControl.TAB:
                if (touchObjList.Count > 1)
                {
                    SwitchObject();
                }
                break;

            case KeyControl.M_LEFT:
                //Debug.Log("111");
                if (isCanneling)
                {
                    StopCanneling();
                }
                UseSkill(1);
                break;
            }
            //Debug.Log(InputDir.x + "," + InputDir.y);
        }
示例#6
0
        private void OnGlobalMessageHandler(MyEvent.MyEvent obj)
        {
            var evt = obj as MyGameEvent;

            if (evt == null)
            {
                return;
            }
            var msg = evt.data.ToString();

            Debug.Log("message " + msg);
            uiMessageWindow.AddText(msg);
        }
示例#7
0
        private void OnClickRecipe(MyEvent.MyEvent obj)
        {
            var icon = obj.data as UI_RecipeListIcon;

            //Debug.Log("click " + icon.masterData.id);
            if (currSelectRecipe != null)
            {
                currSelectRecipe.SetSelect(false);
            }
            icon.SetSelect(true);
            this.currSelectRecipe = icon;
            ShowRecipe();
        }
示例#8
0
        private void OnUpdateDrawCardHandler(MyEvent.MyEvent obj)
        {
            var evt   = obj as CardEvent;
            var data  = evt.data as CardEvent.CardData;
            var index = data.index;
            var card  = data.cards[0];

            if (index == 0)
            {
                ShowDrawCard(index, card);
            }
            else
            {
                //todo
            }
        }
示例#9
0
        private void OnKeyUpHandler(MyEvent.MyEvent obj)
        {
            var key = obj.data.ToString();

            switch (key)
            {
            case KeyControl.UP:
                if (KeyControl.keyCountDic[KeyControl.UP] == 0)
                {
                    InputDir[1] = KeyControl.keyCountDic[KeyControl.DOWN] > 0 ? -1 : 0;
                }
                this.changeDir = true;
                break;

            case KeyControl.DOWN:
                if (KeyControl.keyCountDic[KeyControl.DOWN] == 0)
                {
                    InputDir[1] = KeyControl.keyCountDic[KeyControl.UP] > 0 ? 1 : 0;
                }
                this.changeDir = true;
                break;

            case KeyControl.LEFT:
                if (KeyControl.keyCountDic[KeyControl.LEFT] == 0)
                {
                    InputDir[0] = KeyControl.keyCountDic[KeyControl.RIGHT] > 0 ? 1 : 0;
                }
                this.changeDir = true;
                break;

            case KeyControl.RIGHT:
                if (KeyControl.keyCountDic[KeyControl.RIGHT] == 0)
                {
                    InputDir[0] = KeyControl.keyCountDic[KeyControl.LEFT] > 0 ? -1 : 0;
                }
                this.changeDir = true;
                break;
            }
        }
示例#10
0
 private void OnMapOkHandler(MyEvent.MyEvent obj)
 {
 }
示例#11
0
        private void OnHintMessageHandler(MyEvent.MyEvent obj)
        {
            var arr = (string[])obj.data;

            uiHint.Show(arr[0], arr[1]);
        }
示例#12
0
        private void OnUpdateHandCardsHandler(MyEvent.MyEvent obj)
        {
            var data = (obj as CardEvent).data as CardEvent.CardData;

            UpdateHandCards(data.index, data.cards);
        }
示例#13
0
        private void OnPlayCardHandler(MyEvent.MyEvent obj)
        {
            var data = (obj as CardEvent).data as CardEvent.CardData;

            UpdateTableCard(data.index, data.cards[0]);
        }