Example #1
0
    void Awake()
    {
        Transform dv = transform.Find("Dissolve");

        mDissolve = dv.gameObject;
        mInfo     = dv.Find("info").GetComponent <UILabel>();

        Transform seats = dv.Find("seats");

        for (int i = 0; i < seats.childCount; i++)
        {
            mSeats.Add(seats.GetChild(i));
        }

        mBtnAgree    = dv.Find("btn_agree").gameObject;
        mBtnReject   = dv.Find("btn_reject").gameObject;
        mBtnDissolve = dv.Find("btn_dissolve").gameObject;

        mBtnAgree.GetComponent <UIButton>().onClick.Add(new EventDelegate(this, "onBtnAgree"));
        mBtnReject.GetComponent <UIButton>().onClick.Add(new EventDelegate(this, "onBtnReject"));
        mBtnDissolve.GetComponent <UIButton>().onClick.Add(new EventDelegate(this, "onBtnDissolve"));

        GameMgr gm = GameMgr.GetInstance();

        gm.AddHandler("game_reset", data => {
            mEndTime = 0;
            mDissolve.SetActive(false);
        });

        gm.AddHandler("dissolve_notice", data => {
            showDissolveNotice((DissolveInfo)data);
        });

        gm.AddHandler("dissolve_done", data => {
            mDissolve.SetActive(false);
        });

        gm.AddHandler("dissolve_cancel", data => {
            DissolveCancel dc = (DissolveCancel)data;

            mDissolve.SetActive(false);

            int uid = dc.reject;
            if (uid > 0 && uid != gm.userMgr.userid)
            {
                GameAlert.GetInstance().show("玩家" + uid + "已拒绝解散请求");
            }
        });
    }
Example #2
0
    void InitEventHandler()
    {
        GameMgr gm = GameMgr.GetInstance();

        gm.AddHandler("recommend_room_updated", data => {
            if (!shown)
            {
                return;
            }

            refresh();
        });

        gm.AddHandler("sys_message_updated", data => {
            updateMessageCnt();
        });
    }
Example #3
0
    void Awake()
    {
        layout();

        GameMgr gm = GameMgr.GetInstance();

        gm.AddHandler("club_message_notify", data => {
            refresh();
        });
    }
Example #4
0
    void InitEventHandlers()
    {
        RoomMgr rm = RoomMgr.GetInstance();
        GameMgr gm = GameMgr.GetInstance();

/*
 *              gm.AddHandler ("game_action", data => {
 *                      GameAction action = rm.action;
 *                      _options = action;
 *
 *                      showAction(action);
 *              });
 */

        gm.AddHandler("guo_result", data => {
            hideOptions();
        });

        gm.AddHandler("game_begin", data => {
            hidePrompt();
            showQiaoHelp(false);
            _options = null;
            shot     = false;
        });

        gm.AddHandler("game_playing", data => {
            checkChuPai(rm.isMyTurn());
        });

        gm.AddHandler("game_sync", data => {
            showPrompt();
            shot = false;
        });

        gm.AddHandler("game_chupai_notify", data => {
            ActionInfo info = (ActionInfo)data;

            if (info.seatindex == rm.seatindex)
            {
                Highlight(info.pai, false);
                checkChuPai(false);
            }
        });

        gm.AddHandler("game_turn_change", data => {
            if (rm.isMyTurn())
            {
                checkChuPai(true);
            }

            shot = false;
        });

        gm.AddHandler("hupai", data => {
            lockHandCards();
        });
    }
Example #5
0
    void InitEventHandler()
    {
        GameMgr gm = GameMgr.GetInstance();

        gm.AddHandler("voice_msg", data => {
            onVoiceMsg((VoiceMsgPush)data);
        });

        gm.AddHandler("chat", data => {
            onChat((ChatInfo)data);
        });

        gm.AddHandler("quick_chat_push", data => {
            onQuickChat((QuickChatInfo)data);
        });

        gm.AddHandler("emoji_push", data => {
            onEmoji((EmojiPush)data);
        });
    }
Example #6
0
    void InitEventHandler()
    {
        GameMgr gm = GameMgr.GetInstance();

        gm.AddHandler("club_room_updated", data => {
            if (!mShow)
            {
                return;
            }
            refresh();
        });

        gm.AddHandler("club_room_removed", data => {
            if (!mShow)
            {
                return;
            }
            refresh();
        });
    }
Example #7
0
    void Awake()
    {
        base.Awake();

        GameMgr gm = GameMgr.GetInstance();

        gm.AddHandler("club_message_notify", data => {
            ClubMessageNotify notify = (ClubMessageNotify)data;

            if (notify.club_id == mClubID)
            {
                setCount(notify.cnt);
            }
        });
    }
Example #8
0
    void Awake()
    {
        base.Awake();

        GameMgr gm = GameMgr.GetInstance();

        gm.AddHandler("sys_message_updated", data => {
            if (!mShow)
            {
                return;
            }

            refresh();
        });
    }
Example #9
0
    void InitEventHandler()
    {
        GameMgr gm = GameMgr.GetInstance();

        gm.AddHandler("club_room_updated", data => {
            if (!mShow)
            {
                return;
            }
            refresh();
        });

        gm.AddHandler("club_room_removed", data => {
            if (!mShow)
            {
                return;
            }
            refresh();
        });

        gm.AddHandler("club_message_notify", data => {
            if (!mShow)
            {
                return;
            }

            ClubMessageNotify notify = (ClubMessageNotify)data;

            Debug.Log("club message: " + notify.club_id);

            if (notify.club_id == mClubID)
            {
                setCount(notify.cnt);
            }
        });
    }
Example #10
0
    void Awake()
    {
        GameMgr gm = GameMgr.GetInstance();
        RoomMgr rm = RoomMgr.GetInstance();

        gm.AddHandler("game_sync", data => {
            GameState state = rm.state;

            if (state.state != "maima")
            {
                return;
            }

            showWait();
        });
    }
Example #11
0
        static int _m_AddHandler(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                GameMgr gen_to_be_invoked = (GameMgr)translator.FastGetCSObj(L, 1);



                {
                    string             _msg     = LuaAPI.lua_tostring(L, 2);
                    GameMgr.MsgHandler _handler = translator.GetDelegate <GameMgr.MsgHandler>(L, 3);

                    gen_to_be_invoked.AddHandler(_msg, _handler);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Example #12
0
    void InitEventHandlers()
    {
        RoomMgr       rm = RoomMgr.GetInstance();
        GameMgr       gm = GameMgr.GetInstance();
        PlayerManager pm = PlayerManager.GetInstance();

        gm.AddHandler("game_holds", data => {
            EnQueueCmd("game_holds", data, item => {
                DHM_CardManager cm = pm.getCardManager((int)item.data);
                cm.FaPai();
            });
        });

        gm.AddHandler("game_holds_len", data => {
            EnQueueCmd("game_holds_len", data, item => {
                DHM_CardManager cm = pm.getCardManager((int)item.data);
                cm.FaPai();
            });
        });

        gm.AddHandler("game_begin", data => {
            EnQueueCmd("game_begin", data, item => {
                onGameBegin();
            });
        });

        gm.AddHandler("game_sync", data => {
            EnQueueCmd("game_sync", data, item => {
                if (rm.isPlaying())
                {
                    sync();
                }
            });
        });

        gm.AddHandler("game_action", data => {
            EnQueueCmd("game_action", data, item => {
                InteractMgr.GetInstance().ShowAction();
            });
        });

        gm.AddHandler("game_turn_change", data => {
            EnQueueCmd("game_turn_change", data, item => {
                TurnChange(rm.state.turn);
            });
        });

        gm.AddHandler("game_mopai", data => {
            EnQueueCmd("game_mopai", data, item => {
                ActionInfo info = (ActionInfo)item.data;

                MoPai(info.seatindex, info.pai);
                if (info.seatindex == rm.seatindex)
                {
                    InteractMgr.GetInstance().checkChuPai(true);
                }
            });
        });

        gm.AddHandler("user_hf_updated", data => {
            EnQueueCmd("user_hf_updated", data, item => {
                if (item.data == null)
                {
                    foreach (DHM_CardManager cm in pm.getCardManagers())
                    {
                        cm.UpdateFlowers();
                    }

                    syncDone(item);
                }
                else
                {
                    ActionInfo info = (ActionInfo)item.data;
                    AddFlower(info.seatindex, info.pai, () => syncDone(item));
                }
            }, false);
        });

        gm.AddHandler("hupai", data => {
            EnQueueCmd("hupai", data, item => {
                Hu((HuPushInfo)item.data, () => syncDone(item));
            }, false);
        });

        gm.AddHandler("game_chupai_notify", data => {
            EnQueueCmd("game_chupai_notify", data, item => {
                ActionInfo info = (ActionInfo)item.data;
                SomeOneChuPai(info.seatindex, info.pai, () => syncDone(item));
            }, false);
        });

        gm.AddHandler("guo_notify", data => {
            EnQueueCmd("guo_notify", data, item => {
                Guo();
            });
        });

        gm.AddHandler("peng_notify", data => {
            EnQueueCmd("peng_notify", data, item => {
                ActionInfo info = (ActionInfo)item.data;
                int si          = info.seatindex;

                Peng(si, info.pai);
            });
        });

        gm.AddHandler("ting_notify", data => {
            EnQueueCmd("ting_notify", data, item => {
                int si = (int)item.data;

                MainViewMgr.GetInstance().showAction(si, "ting");

                if (si == rm.seatindex)
                {
                    InteractMgr im = InteractMgr.GetInstance();

                    im.showPrompt();
                    im.checkChuPai(true);
                }

                DHM_CardManager cm = pm.getCardManager(si);
                cm.Ting();
            });
        });

        gm.AddHandler("chi_notify", data => {
            EnQueueCmd("chi_notify", data, item => {
                ActionInfo info = (ActionInfo)item.data;
                int si          = info.seatindex;

                Chi(si, info.pai);
            });
        });

        gm.AddHandler("gang_notify", data => {
            EnQueueCmd("gang_notify", data, item => {
                GangInfo info = (GangInfo)item.data;
                int type      = 0;
                int si        = info.seatindex;

                switch (info.gangtype)
                {
                case "diangang":
                    type = 1;
                    break;

                case "angang":
                    type = 2;
                    break;

                case "wangang":
                    type = 3;
                    break;
                }

                Debug.Log("gang_notify: type=" + info.gangtype + " pai=" + info.pai);

                Gang(si, info.pai, type);
            });
        });

        gm.AddHandler("game_dice", data => {
            EnQueueCmd("game_dice", data, item => {
                PlaySaiZi(rm.state.button, new int[] { rm.state.dice1, rm.state.dice2 });
            });
        });

        gm.AddHandler("game_over", data => {
            EnQueueCmd("game_over", data, item => {
                MainViewMgr.GetInstance().GameOver();
            });
        });

        gm.AddHandler("game_wait_maima", data => {
            EnQueueCmd("game_wait_maima", data, item => {
                MainViewMgr.GetInstance().showMaimaWait();
            });
        });

        gm.AddHandler("game_maima", data => {
            EnQueueCmd("game_maima", data, item => {
                MainViewMgr.GetInstance().showMaimaResult(() => syncDone(item));
            }, false);
        });
    }
Example #13
0
    void InitEventHandlers()
    {
        GameMgr gm = GameMgr.GetInstance();
        RoomMgr rm = RoomMgr.GetInstance();

        gm.AddHandler("mj_count", data => {
            mjcnt.text = rm.state.numofmj + "张";
        });

        gm.AddHandler("game_num", data => {
            //gamenum.text = "第" + rm.info.numofgames + "局(" + rm.conf.maxGames + ")";
            gamenum.text = "[D82828]" + rm.info.numofgames + "[FFFFFF]/" + rm.conf.maxGames + "局";
        });

        gm.AddHandler("new_user", data => {
            InitSingleSeat((int)data);
        });

        gm.AddHandler("user_state_changed", data => {
            refreshBtns();
            InitSingleSeat((int)data);
        });

        gm.AddHandler("game_begin", data => {
            enablePrepare(false);
            refreshBtns();
            InitSeats();
        });

        gm.AddHandler("game_sync", data => {
            enablePrepare(false);
            refreshBtns();
            InitSeats();
            mjcnt.text = rm.state.numofmj + "张";
            //gamenum.text = "第" + rm.info.numofgames + "局(" + rm.conf.maxGames + ")";
            gamenum.text = "[D82828]" + rm.info.numofgames + "[FFFFFF]/" + rm.conf.maxGames + "局";
        });

        gm.AddHandler("hupai", data => {
            HuPushInfo info = (HuPushInfo)data;
            InitSingleSeat(info.seatindex);
        });

        gm.AddHandler("game_num", data => {
            refreshBtns();
        });

        gm.AddHandler("game_state", data => {
            refreshBtns();
            InitSeats();
        });

        gm.AddHandler("ting_notify", data => {
            InitSingleSeat((int)data);
        });

        gm.AddHandler("user_ready", data => {
            InitSingleSeat((int)data);
        });

        gm.AddHandler("chat", data => {
            ChatInfo info = (ChatInfo)data;

            chat(info.sender, info.content);
        });

        gm.AddHandler("voice_msg", data => {
            voice((VoiceMsgPush)data);
        });

        gm.AddHandler("quick_chat_push", data => {
            QuickChatInfo info = (QuickChatInfo)data;
            quickchat(info.sender, info.content);
        });

        gm.AddHandler("emoji_push", data => {
            EmojiPush info = (EmojiPush)data;

            emoji(info.sender, info.content + 1);
        });

        gm.AddHandler("demoji_push", data => {
            DEmojiPush info = (DEmojiPush)data;

            demoji(info.sender, info.target, info.id);
        });
    }