Beispiel #1
0
    protected override void DispatchDeadEvent(Units attacker)
    {
        if (base.MirrorState)
        {
            return;
        }
        if (this.isHero && attacker != null && (attacker.isHero || attacker.isPlayer))
        {
            Singleton <TriggerManager> .Instance.SendUnitStateEvent(UnitEvent.UnitKillAndAssist, attacker, null, null);
        }
        MobaMessageManager.DispatchMsg(MobaMessageManager.GetMessage((ClientMsg)25056, new ParamUnitDead(attacker, this), 0f));
        Singleton <TriggerManager> .Instance.SendGameStateEvent(GameEvent.UntiDead);

        Singleton <TriggerManager> .Instance.SendUnitStateEvent(UnitEvent.UnitKillTarget, attacker, this, null);

        Singleton <TriggerManager> .Instance.SendUnitStateEvent(UnitEvent.UnitDeath, this, attacker, null);

        if (this.isHero)
        {
            if (base.teamType == 0)
            {
                Singleton <TriggerManager> .Instance.SendGameStateEvent(GameEvent.LMHeroDead);
            }
            else if (base.teamType == 1)
            {
                Singleton <TriggerManager> .Instance.SendGameStateEvent(GameEvent.BLHeroDead);
            }
        }
        base.DispatchDeadEvent(attacker);
    }
        public static void DoPveBuy(ShopInfo shopInfo, Units unit, string targetItemID, List <ItemInfo> possessItemsP, int realPrice)
        {
            List <ItemInfo> list        = new List <ItemInfo>(possessItemsP);
            List <string>   composition = BattleEquipTools_Travers.GetComposition(targetItemID, list);

            if (composition != null || composition.Count > 0)
            {
                for (int i = 0; i < composition.Count; i++)
                {
                    ItemInfo target;
                    int      index;
                    if (BattleEquipTools_Travers.GetItem_last_least(list, composition[i], out target, out index))
                    {
                        BattleEquipTools_op.RemoveItem(list, target, index);
                    }
                }
            }
            BattleEquipTools_op.AddItem(list, targetItemID);
            BattleEquipTools_op.ChangeHeroMoney(unit.unique_id, -realPrice);
            BattleEquipTools_op.SetHeroItems(unit, list);
            byte[] msgParam = SerializeHelper.Serialize <P2CBuyItem>(new P2CBuyItem
            {
                itemoid  = 0,
                retaCode = 0
            });
            MobaMessage message = MobaMessageManager.GetMessage(PvpCode.C2P_BuyItem, msgParam, 0f, null);

            MobaMessageManager.DispatchMsg(message);
        }
        private void L2C_RoomRespChangeHero(MobaMessage msg)
        {
            OperationResponse operationResponse = msg.Param as OperationResponse;
            byte inResult = (byte)operationResponse.Parameters[0];
            int  inNewUid = (int)operationResponse.Parameters[1];

            MobaMessageManager.DispatchMsg((ClientMsg)23069, new ParamShowSwitchHeroResult(inNewUid, inResult), 0f);
        }
Beispiel #4
0
    private void SwitchHero(GameObject obj)
    {
        Singleton <PvpSelectHeroView> .Instance.SetCurNewUidSwitched(this._bindedNewUid);

        Singleton <PvpManager> .Instance.ReqSwitchHero(this._bindedNewUid);

        MobaMessageManager.DispatchMsg((ClientMsg)23068, new ParamShowSwitchHeroInfo(EShowSwitchHeroInfoType.ReqType, this._bindedNewUid), 0f);
    }
Beispiel #5
0
 private void DispatchTimeOutMsg()
 {
     if (this._type != MobaMessageType.Client)
     {
         MsgData_WaitServerResponsTimeout msgParam = new MsgData_WaitServerResponsTimeout(this._type, this._code);
         MobaMessage message = MobaMessageManager.GetMessage((ClientMsg)25012, msgParam, 0f);
         MobaMessageManager.DispatchMsg(message);
     }
 }
Beispiel #6
0
        public void OnSelectHeroSkill(int userId, string skillId)
        {
            ReadyPlayerSampleInfo readyPlayerSampleInfo = this.TryFindPlayerInfo(userId, null);

            if (readyPlayerSampleInfo != null)
            {
                readyPlayerSampleInfo.selfDefSkillId = skillId;
                MobaMessageManager.DispatchMsg(ClientC2C.PvpSelectHeroSkill, new ParamSelectHeroSkill(userId, skillId));
            }
        }
        private void L2C_ModifyState(MobaMessage msg)
        {
            OperationResponse operationResponse = msg.Param as OperationResponse;
            int num      = (int)operationResponse.Parameters[0];
            int inNewUid = (int)operationResponse.Parameters[1];

            if (num == 1)
            {
                MobaMessageManager.DispatchMsg((ClientMsg)23069, new ParamShowSwitchHeroResult(inNewUid, 2), 0f);
            }
        }
Beispiel #8
0
        public void OnSelectHeroSkin(int userId, string skinId)
        {
            ReadyPlayerSampleInfo readyPlayerSampleInfo = this.TryFindPlayerInfo(userId, "OnSelectHeroSkin");

            if (readyPlayerSampleInfo != null)
            {
                readyPlayerSampleInfo.heroSkinId = skinId;
                HeroSkins.SetHeroSkin(this.GetTeam(userId), this.GetPlayerHero(userId), int.Parse(skinId));
                MobaMessageManager.DispatchMsg(ClientC2C.PvpSelectHeroSkin, new ParamSelectHeroSkin(userId, skinId));
            }
        }
Beispiel #9
0
        private void TryUpdateInfo(ActiveSurrenderInfo info)
        {
            TeamType teamType = this.IsLm(info);

            if (Singleton <PvpManager> .Instance.SelfTeamType == teamType && SurrenderMgr.IsVisible(info))
            {
                this._activeSurrenderInfo = info;
                this.HasAllVoted          = (info.validVoters.Count == info.votes.Count);
                CtrlManager.OpenWindow(WindowID.SurrenderView, null);
                MobaMessageManager.DispatchMsg((ClientMsg)23064, info, 0f);
            }
        }
    public void ApplyChange()
    {
        List <ItemDynData>   equipList = this.EquipList;
        IEnumerable <string> source    = from x in equipList
                                         select x.typeId;
        List <string> equips = source.ToList <string>();

        BattleEquipTools_op.ApplyEquipsToHero(equips, (Hero)this.self);
        this.self.SetItemSkill(this.EquipList);
        HeroItemsChangedData msgParam = new HeroItemsChangedData(this.self.unique_id, equipList);

        MobaMessageManager.DispatchMsg(MobaMessageManager.GetMessage((ClientMsg)25043, msgParam, 0f));
    }
Beispiel #11
0
        public void OnSelectHeroOk(int newUid, bool ok)
        {
            ReadyPlayerSampleInfo readyPlayerSampleInfo = this.TryFindPlayerInfo(newUid, "OnSelectHeroOk");

            if (readyPlayerSampleInfo != null)
            {
                readyPlayerSampleInfo.horeSelected = ok;
                if (!ok)
                {
                    readyPlayerSampleInfo.heroInfo = null;
                }
                MobaMessageManager.DispatchMsg(ClientC2C.PvpSelectHeroOk, new ParamSelectHero(newUid, readyPlayerSampleInfo.heroInfo));
            }
        }
    public static void SendClientMsg(object code, object param = null, bool dispatch = false)
    {
        ClientMsg   msgID   = (ClientMsg)((int)code);
        MobaMessage message = MobaMessageManager.GetMessage(msgID, param, 0f);

        if (dispatch)
        {
            MobaMessageManager.DispatchMsg(message);
        }
        else
        {
            MobaMessageManager.ExecuteMsg(message);
        }
    }
Beispiel #13
0
        public void OnSelectHero(int userId, HeroInfo info)
        {
            ReadyPlayerSampleInfo readyPlayerSampleInfo = this.TryFindPlayerInfo(userId, "OnSelectHero");

            if (readyPlayerSampleInfo != null)
            {
                readyPlayerSampleInfo.heroInfo = info;
                MobaMessageManager.DispatchMsg(ClientC2C.PvpSelectHero, new ParamSelectHero(userId, info));
            }
            else
            {
                ClientLogger.Error("OnSelectHero null hero: " + userId);
            }
        }
Beispiel #14
0
        public override void OnEnter()
        {
            base.OnEnter();
            this.InitBottleViewCtrl(true);
            this.InitSacrificialCtrl(true);
            this.InitHomeChatCtrl(true);
            this.IniRunesCtrl(true);
            MobaMessage message = MobaMessageManager.GetMessage((ClientMsg)25011, null, 0f);

            MobaMessageManager.DispatchMsg(message);
            this.bottleins.Init();
            this.sacrificialins.Init();
            this.homechatins.Init();
            this.runesins.Init();
        }
        public static void DoPveRollback(ShopInfo shopInfo, Units unit)
        {
            RollbackInfo rollbackInfo = shopInfo.RollbackStack.Peek();

            if (rollbackInfo != null)
            {
                BattleEquipTools_op.ChangeHeroMoney(unit.unique_id, -rollbackInfo._deltaMoney);
                BattleEquipTools_op.SetHeroItems(unit, rollbackInfo._items);
            }
            byte[] msgParam = SerializeHelper.Serialize <RetaMsg>(new RetaMsg
            {
                retaCode = 0
            });
            MobaMessage message = MobaMessageManager.GetMessage(PvpCode.C2P_RevertShop, msgParam, 0f, null);

            MobaMessageManager.DispatchMsg(message);
        }
Beispiel #16
0
        private void OnLoadFinish(PVPHeroCard com)
        {
            int userID = com.InitInfo.userID;

            if (!this.list_finishLoadList.Contains(userID) && this.dic_com.Keys.Contains(userID))
            {
                this.list_finishLoadList.Add(userID);
                if (this.list_finishLoadList.Count == this.dic_com.Count)
                {
                    if (this.task_checkProgress != null)
                    {
                        this.task_checkProgress.Stop();
                    }
                    MobaMessageManager.DispatchMsg((ClientMsg)21008, null, 0f);
                }
            }
        }
        public static void DoPveSell(ShopInfo shopInfo, Units unit, ItemInfo targetItem, List <ItemInfo> possessItemsP)
        {
            List <ItemInfo> items     = new List <ItemInfo>(possessItemsP);
            int             itemPrice = BattleEquipTools_config.GetItemPrice(targetItem.ID);
            int             delta     = (int)((float)itemPrice * 0.8f);

            BattleEquipTools_op.RemoveItem(items, targetItem);
            BattleEquipTools_op.ChangeHeroMoney(unit.unique_id, delta);
            BattleEquipTools_op.SetHeroItems(unit, items);
            byte[] msgParam = SerializeHelper.Serialize <P2CSellItem>(new P2CSellItem
            {
                itemoid  = 0,
                retaCode = 0
            });
            MobaMessage message = MobaMessageManager.GetMessage(PvpCode.C2P_SellItem, msgParam, 0f, null);

            MobaMessageManager.DispatchMsg(message);
        }
        public static void DispatchChooseGameMsg()
        {
            LevelStorage?levelStorage = PvpLevelStorage.FetchLast();

            if (levelStorage.HasValue)
            {
                string battleId = levelStorage.Value.battleId;
                int    num;
                if (int.TryParse(battleId, out num))
                {
                    MobaMessageManager.DispatchMsg((ClientMsg)26002, new object[]
                    {
                        num,
                        levelStorage.Value.matchType
                    }, 0f);
                }
                else
                {
                    ClientLogger.Error("cannot parse BattleId " + battleId);
                }
            }
        }
Beispiel #19
0
        private void P2C_LoadProcess(MobaMessage msg)
        {
            Shader.WarmupAllShaders();
            C2PLoadProcess probufMsg = msg.GetProbufMsg <C2PLoadProcess>();
            int            newUid    = probufMsg.newUid;
            byte           process   = probufMsg.process;

            PvpStateBase.LogState(string.Concat(new object[]
            {
                "===>receive: P2C_LoadProcess:",
                newUid,
                " ",
                process
            }));
            HeroExtraInRoom heroExtraByUserId = Singleton <PvpManager> .Instance.RoomInfo.GetHeroExtraByUserId(newUid);

            if (heroExtraByUserId != null)
            {
                heroExtraByUserId.LoadProgress = (int)process;
            }
            MobaMessageManager.DispatchMsg(ClientC2C.PvpLoadProcess, new ParamLoadProcess(newUid, process));
        }
Beispiel #20
0
 private void OnStartGame(MobaMessage msg)
 {
     MobaMessageManager.DispatchMsg(MobaMessageManager.GetMessage((ClientMsg)25013, null, 0f));
     this._isReady = true;
 }
Beispiel #21
0
    private void OnNotificationEvent(int ret, string debugMessage, NotificationData notificationData)
    {
        if (notificationData == null || notificationData.Content == null)
        {
            return;
        }
        if (ret == 0)
        {
            this.oldNotificationDataContent = notificationData.Content;
            short type = notificationData.Type;
            switch (type + 5)
            {
            case 0:
                MobaMessageManager.ExecuteMsg(MobaMessageManager.GetMessage((ClientMsg)23066, notificationData, 0f));
                break;

            case 1:
                MobaMessageManager.DispatchMsg(MobaMessageManager.GetMessage((ClientMsg)25024, null, 0f));
                NetWorkHelper.Instance.Enable(false);
                CtrlManager.ShowMsgBox("服务器提示", notificationData.Content, new Action(GlobalObject.QuitApp), PopViewType.PopOneButton, "确定", "取消", null);
                break;

            case 2:
                NetWorkHelper.Instance.Enable(false);
                CtrlManager.ShowMsgBox("服务器维护", "请点击确认,退出游戏", new Action(GlobalObject.QuitApp), PopViewType.PopOneButton, "确定", "取消", null);
                break;

            case 3:
                CtrlManager.ShowMsgBox("服务器提示", notificationData.Content, null, PopViewType.PopOneButton, "确定", "取消", null);
                break;

            case 4:
                CtrlManager.ShowMsgBox("服务器重启提示", "服务器已经重启,客户端将在5秒后强制退出,退出后请尝试重新登入!", new Action(GlobalObject.ReStartGame), PopViewType.PopOneButton, "立刻退出", "取消", null);
                break;

            case 5:
                SendMsgManager.Instance.SendMsg(MobaGameCode.GetCurrencyCount, null, new object[]
                {
                    1
                });
                SendMsgManager.Instance.SendMsg(MobaGameCode.GetCurrencyCount, null, new object[]
                {
                    2
                });
                break;

            case 12:
                Singleton <FriendView> .Instance.UpdateNewApply(notificationData.Content);

                Singleton <PvpRoomView> .Instance.UpdateApplyState(notificationData.Content);

                Singleton <HomeChatview> .Instance.UpdateFriendList(true, string.Empty);

                break;

            case 14:
                Singleton <FriendView> .Instance.AddMessage(notificationData.Content);

                Singleton <HomeChatview> .Instance.AddFriendMessage(notificationData.Content);

                Singleton <MenuView> .Instance.SetNews(14, "0");

                break;

            case 15:
                Singleton <FriendView> .Instance.UpdateNewApply(notificationData.Content);

                Singleton <PvpRoomView> .Instance.UpdateApplyState(notificationData.Content);

                break;

            case 16:
                Singleton <PvpRoomView> .Instance.InviteGoToRoom(notificationData.Content);

                break;

            case 17:
                if (Singleton <PvpRoomView> .Instance.gameObject != null && Singleton <PvpRoomView> .Instance.gameObject.activeInHierarchy)
                {
                    Singleton <PvpRoomView> .Instance.RefuseGoToRoom(notificationData.Content);
                }
                break;

            case 19:
                Singleton <FriendView> .Instance.UpdateApplyState(notificationData.Content, true);

                Singleton <PvpRoomView> .Instance.UpdateApplyState(notificationData.Content);

                if (Singleton <HomeChatview> .Instance.gameObject != null && Singleton <HomeChatview> .Instance.gameObject.activeInHierarchy)
                {
                    Singleton <HomeChatview> .Instance.UnFriended();
                }
                Singleton <HomeChatview> .Instance.UpdateFriendList(false, notificationData.Content);

                break;

            case 20:
                Singleton <FriendView> .Instance.UpdateApplyState(notificationData.Content, true);

                Singleton <PvpRoomView> .Instance.UpdateApplyState(notificationData.Content);

                if (Singleton <HomeChatview> .Instance.gameObject != null && Singleton <HomeChatview> .Instance.gameObject.activeInHierarchy)
                {
                    Singleton <HomeChatview> .Instance.UnFriended();
                }
                Singleton <HomeChatview> .Instance.UpdateFriendList(false, notificationData.Content);

                break;

            case 23:
            {
                if (Singleton <FriendView> .Instance.gameObject != null && Singleton <FriendView> .Instance.gameObject.activeInHierarchy)
                {
                    Singleton <FriendView> .Instance.UpdateFriendState(notificationData.Content);
                }
                if (Singleton <PvpRoomView> .Instance.gameObject != null && Singleton <PvpRoomView> .Instance.gameObject.activeInHierarchy)
                {
                    Singleton <PvpRoomView> .Instance.UpdateFriendState(notificationData.Content);
                }
                if (Singleton <HomeChatview> .Instance.gameObject != null)
                {
                    Singleton <HomeChatview> .Instance.UpdateFriendState(notificationData.Content);
                }
                string[] stateStrs = notificationData.Content.Split(new char[]
                    {
                        '|'
                    });
                if (stateStrs != null)
                {
                    if (stateStrs.Length >= 3)
                    {
                        List <FriendData> list = ModelManager.Instance.Get_FriendDataList_X();
                        if (list != null)
                        {
                            FriendData friendData = list.Find((FriendData _obj) => _obj.TargetId.ToString() == stateStrs[1]);
                            if (friendData != null)
                            {
                                friendData.GameStatus = (sbyte)int.Parse(stateStrs[2]);
                            }
                        }
                    }
                    Singleton <MenuBottomBarView> .Instance.UpdateFriendNum();
                }
                break;
            }

            case 24:
                SendMsgManager.Instance.SendMsg(MobaGameCode.GetMailList, null, new object[0]);
                break;

            case 30:
                Singleton <TipView> .Instance.ShowViewSetText("已经在房间中!", 1f);

                Singleton <PvpRoomView> .Instance.ErrorToLeve();

                break;

            case 31:
                Singleton <TipView> .Instance.ShowViewSetText("房间关闭!", 1f);

                break;

            case 32:
                Singleton <TipView> .Instance.ShowViewSetText("房间已经满员!", 1f);

                break;

            case 33:
                Singleton <TipView> .Instance.ShowViewSetText("房间已经不存在!", 1f);

                break;

            case 34:
                Singleton <TipView> .Instance.ShowViewSetText("不是房主无法操作!", 1f);

                break;

            case 35:
                Singleton <TipView> .Instance.ShowViewSetText("当前无法修改房间的类型!", 1f);

                break;

            case 36:
                Singleton <TipView> .Instance.ShowViewSetText("不在房间中!", 1f);

                break;
            }
        }
    }
    public static void DispatchMsg(ClientMsg msgId, object msgParam, float delay = 0f)
    {
        MobaMessage message = MobaMessageManager.GetMessage(msgId, msgParam, delay);

        MobaMessageManager.DispatchMsg(message);
    }
    public static void DispatchMsg(PvpCode msgId, object msgParam, float delay = 0f)
    {
        MobaMessage message = MobaMessageManager.GetMessage(msgId, msgParam, delay, null);

        MobaMessageManager.DispatchMsg(message);
    }
 public static void DispatchMsg(ClientC2C msgId, object msgParam)
 {
     MobaMessageManager.DispatchMsg((ClientMsg)msgId, msgParam, 0f);
 }