Esempio n. 1
0
        private IEnumerator DepotTakeOutCoroutine(int index)
        {
            using (new BlockingLayerHelper(0))
            {
                var msg = NetManager.Instance.DepotTakeOut(index);
                yield return(msg.SendAndWaitUntilDone());

                if (msg.State == MessageState.Reply)
                {
                    if (msg.ErrorCode == (int)ErrorCodes.OK)
                    {
                        //从仓库取出
                        var e = new ShowUIHintBoard(270048);
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                    else if (msg.ErrorCode == (int)ErrorCodes.Error_ItemNoInBag_All)
                    {
                        //目标背包已满,无法再放入物品
                        var e = new ShowUIHintBoard(270049);
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                    else
                    {
                        UIManager.Instance.ShowNetError(msg.ErrorCode);
                        Logger.Error("DepotTakeOut Error!............ErrorCode..." + msg.ErrorCode);
                    }
                }
                else
                {
                    Logger.Error("DepotTakeOut Error!............State..." + msg.State);
                }
            }
        }
Esempio n. 2
0
    public IEnumerator SelectTitle(int Id, int index)
    {
        using (new BlockingLayerHelper(0))
        {
            var msg = NetManager.Instance.SelectTitle(Id);
            yield return(msg.SendAndWaitUntilDone());

            if (msg.State == MessageState.Reply)
            {
                if (msg.ErrorCode == (int)ErrorCodes.OK)
                {
                    foreach (var model in DataModel.Lists)
                    {
                        if (model.State == (int)TitleState.PutOn)
                        {
                            model.State = (int)TitleState.ActiveNoPutOn;
                            break;
                        }
                    }

                    DataModel.Lists[index].State = (int)TitleState.PutOn;
                }
                else
                {
                    UIManager.Instance.ShowNetError(msg.ErrorCode);
                }
            }
            else
            {
                var e = new ShowUIHintBoard(220821);
                EventDispatcher.Instance.DispatchEvent(e);
            }
        }
    }
Esempio n. 3
0
    public IEnumerator SendResetSkillTalentMsg(SkillBoxDataModel skillBoxData)
    {
        using (new BlockingLayerHelper(0))
        {
            var msg = NetManager.Instance.ResetSkillTalent(skillBoxData.SkillId);
            yield return(msg.SendAndWaitUntilDone());

            if (msg.State == MessageState.Reply)
            {
                if (msg.ErrorCode == (int)ErrorCodes.OK)
                {
                    PlatformHelper.Event("skill", "ResetSkillTalent", skillBoxData.SkillId);
                    PlatformHelper.UMEvent("skill", "ResetSkillTalent", skillBoxData.SkillId);

                    RestSkillTalentData(skillBoxData);
                    RefreshTalentBoardDesc(currentShowTalentId);
                    var e = new ShowUIHintBoard(709);
                    EventDispatcher.Instance.DispatchEvent(e);
                }
                else
                {
                    if (msg.ErrorCode == (int)ErrorCodes.ItemNotEnough)
                    {
                        var e = new ShowUIHintBoard(703);
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                    else
                    {
                        UIManager.Instance.ShowNetError(msg.ErrorCode);
                    }
                }
            }
        }
    }
Esempio n. 4
0
        private IEnumerator DepotPutInCoroutine(int bagId, int index)
        {
            using (new BlockingLayerHelper(0))
            {
                var msg = NetManager.Instance.DepotPutIn(bagId, index);
                yield return(msg.SendAndWaitUntilDone());

                if (msg.State == MessageState.Reply)
                {
                    if (msg.ErrorCode == (int)ErrorCodes.OK)
                    {
                        //存入仓库
                        var e = new ShowUIHintBoard(270050);
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                    else if (msg.ErrorCode == (int)ErrorCodes.Error_ItemNoInBag_All)
                    {
                        var e = new ShowUIHintBoard(531);
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                    else
                    {
                        UIManager.Instance.ShowNetError(msg.ErrorCode);
                        Logger.Error("DepotPutIn Error!............ErrorCode..." + msg.ErrorCode);
                    }
                }
                else
                {
                    Logger.Error("DepotPutIn Error!............State..." + msg.State);
                }
            }
        }
Esempio n. 5
0
        //帮助按钮事件
        private void HelpButtonClick(int index)
        {
            if (!CheckAnswerCondition())
            {
                return;
            }
            if (m_iNextAnswer > MaxCount)
            {
                return;
            }
            if (m_iNextAnswer <= 0)
            {
                return;
            }
            switch (index)
            {
            case 0:
            {
                var _count = PlayerDataManager.Instance.GetItemCount((int)eBagType.BaseItem, 22051);
                if (_count < 1)
                {
                    var _e = new ShowUIHintBoard(270002);
                    EventDispatcher.Instance.DispatchEvent(_e);
                    GameUtils.ShowQuickBuy(22051, 1);
                    return;
                }
                NetManager.Instance.StartCoroutine(SolveProblemUseItem());
            }
            break;

            case 1:
            {
                var _count = PlayerDataManager.Instance.GetItemCount((int)eBagType.BaseItem, 22052);
                if (_count < 1)
                {
                    var _e = new ShowUIHintBoard(270002);
                    EventDispatcher.Instance.DispatchEvent(_e);
                    GameUtils.ShowQuickBuy(22052, 1);
                    return;
                }
                var _isAlreadyReduce = false;
                for (var i = 0; i < DataModel.Option.Count; i++)
                {
                    if (DataModel.Option[i].TipState == 2)
                    {
                        _isAlreadyReduce = true;
                        break;
                    }
                }
                if (_isAlreadyReduce)
                {
                    var _e = new ShowUIHintBoard(270232);
                    EventDispatcher.Instance.DispatchEvent(_e);
                    return;
                }
                NetManager.Instance.StartCoroutine(RemoveMistakeAnswer());
            }
            break;
            }
        }
Esempio n. 6
0
        private bool CheckAnswerCondition()
        {
            var tbDynamic = Table.GetDynamicActivity(3);

            if (tbDynamic == null)
            {
                return(false);
            }

            if (!GameUtils.CheckIsWeekLoopOk(tbDynamic.WeekLoop))
            {
                GameUtils.ShowHintTip(100002211);
                return(false);
            }

            if (PlayerDataManager.Instance.CheckCondition(tbDynamic.OpenCondition) != 0)
            {
                //不能答题
                var _e = new ShowUIHintBoard(100002211);
                EventDispatcher.Instance.DispatchEvent(_e);
                return(false);
            }
            else
            {
                return(true);
            }
        }
        private void OnOfflineExpCloses(IEvent ievent)
        {
            if (DataModel.Multi == 2)
            {
                //var cost = int.Parse(Table.GetClientConfig(589).Value);
                var cost = DataModel.Cost;
                if (cost > PlayerDataManager.Instance.GetRes((int)eResourcesType.DiamondRes))
                {
                    var ec = new Close_UI_Event(UIConfig.NewOfflineExpFrame);
                    EventDispatcher.Instance.DispatchEvent(ec);

                    var _ee = new ShowUIHintBoard(210102);
                    EventDispatcher.Instance.DispatchEvent(_ee);

                    var _e = new Show_UI_Event(UIConfig.RechargeFrame, new RechargeFrameArguments {
                        Tab = 0
                    });
                    EventDispatcher.Instance.DispatchEvent(_e);
                    return;
                }
            }
            NetManager.Instance.StartCoroutine(GetOfflineExp());
            var e = new Close_UI_Event(UIConfig.NewOfflineExpFrame);

            EventDispatcher.Instance.DispatchEvent(e);
        }
Esempio n. 8
0
        //获得问题
        private IEnumerator GetProblemData(int index)
        {
            using (new BlockingLayerHelper(0))
            {
                var _msg = NetManager.Instance.GetQuestionData(index);
                yield return(_msg.SendAndWaitUntilDone());

                if (_msg.State == MessageState.Reply)
                {
                    if (_msg.ErrorCode == (int)ErrorCodes.OK)
                    {
                        BuildRadom(_msg.Response);
                    }
                    else
                    {
                        UIManager.Instance.ShowNetError(_msg.ErrorCode);
                    }
                }
                else
                {
                    var _e = new ShowUIHintBoard(220821);
                    EventDispatcher.Instance.DispatchEvent(_e);
                }
            }
        }
    private void BuyInvestment()
    {
        var tbActivity   = GetRechargeActive(_mSelectedMenuItem.ActivityId);
        var tbRecharge   = GetRechargeActiveCumulative(tbActivity.SonType);
        var conditionDic = PlayerDataManager.Instance.CheckCondition(tbRecharge.ConditionId);

        if (conditionDic != 0)
        {
            var e = new ShowUIHintBoard(conditionDic);
            EventDispatcher.Instance.DispatchEvent(e);
            return;
        }

        var id = DataModel.Investment.Id;

        //道具不足
//         if (PlayerDataManager.Instance.GetRes(tbRecharge.NeedItemId) < tbRecharge.NeedItemCount)
//         {
//             var str = string.Format(GameUtils.GetDictionaryText(270011), Table.GetItemBase(tbRecharge.NeedItemId).Name);
//             var ee = new ShowUIHintBoard(str);
//             EventDispatcher.Instance.DispatchEvent(ee);
//             return;
//         }
        NetManager.Instance.StartCoroutine(BuyInvestment(id));
    }
Esempio n. 10
0
    //升级技能
    public IEnumerator SendUpGradeSkillMassage(int skillid)
    {
        using (new BlockingLayerHelper(0))
        {
            var msg = NetManager.Instance.UpgradeSkill(skillid);
            yield return(msg.SendAndWaitUntilDone());

            if (msg.State == MessageState.Reply)
            {
                if (msg.ErrorCode == (int)ErrorCodes.OK)
                {
                    PlayerDataManager.Instance.WeakNoticeData.SkillCanUpgrade = false;
                    PlayerDataManager.Instance.WeakNoticeData.SkillTotal      = false;

                    PlatformHelper.Event("skill", "upgrade", skillid);
                    PlatformHelper.UMEvent("skill", "upgrade", skillid);
                    EventDispatcher.Instance.DispatchEvent(new UIEvent_SkillFrame_SkillLevelUpEffect(skillid));
                    ChangeSkillLevelFromDataModel(skillid);
                }
                else
                {
                    if (msg.ErrorCode == (int)ErrorCodes.Error_SkillLevelMax)
                    {
                        var e = new ShowUIHintBoard(700);
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                    else
                    {
                        UIManager.Instance.ShowNetError(msg.ErrorCode);
                    }
                }
            }
        }
    }
Esempio n. 11
0
    public IEnumerator RecycleItemCorotion()
    {
        using (var blockingLayer = new BlockingLayerHelper(0))
        {
            var item = DataModel.ItemData;
            var msg  = NetManager.Instance.RecycleBagItem(item.BagId, item.ItemId, item.Index, DataModel.RecycleCount);
            yield return(msg.SendAndWaitUntilDone());

            if (msg.State == MessageState.Reply)
            {
                if (msg.ErrorCode == (int)ErrorCodes.OK)
                {
                    //回收成功
                    var e1 = new ShowUIHintBoard(270110);
                    EventDispatcher.Instance.DispatchEvent(e1);
                    var e = new Close_UI_Event(UIConfig.ItemInfoUI);
                    EventDispatcher.Instance.DispatchEvent(e);
                }
                else
                {
                    UIManager.Instance.ShowNetError(msg.ErrorCode);
                }
            }
            else
            {
                Logger.Info(string.Format("SellItemCorotion....State = {0} ErroeCode = {1}", msg.State, msg.ErrorCode));
            }
        }
    }
Esempio n. 12
0
    public void LogicNotifyMessage(int type, string info, int addChat)
    {
        switch ((eLogicNotifyType)type)
        {
        case eLogicNotifyType.Dictionary:
        {
            var dicId = info.ToInt();
            if (dicId == -1)
            {
                ShowDictionaryTip(info, addChat == 1);
            }
            else
            {
                ShowDictionaryTip(dicId, addChat == 1);
            }
        }
        break;

        case eLogicNotifyType.BagFull:
        {
            var id = info.ToInt();
            var e  = new ShowUIHintBoard(id);
            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;

        default:
            throw new ArgumentOutOfRangeException("type");
        }
    }
Esempio n. 13
0
 //显示部位信息
 public void OnShowStarTip(int type)
 {
     if (type == 0)
     {
         //已到达最前端
         var e = new ShowUIHintBoard(270129);
         EventDispatcher.Instance.DispatchEvent(e);
     }
     else
     {
         var partData = DataModel.PartData;
         var tbTrain  = Table.GetWingTrain(partData.TrainId);
         if (tbTrain.TrainCount == 10)
         {
             //已到达最尾端
             var e = new ShowUIHintBoard(270130);
             EventDispatcher.Instance.DispatchEvent(e);
         }
         else
         {
             //当前培养到最大才能开启下一阶段
             var e = new ShowUIHintBoard(270131);
             EventDispatcher.Instance.DispatchEvent(e);
         }
     }
 }
Esempio n. 14
0
    //领取邮件
    public void ReceiveMail()
    {
        var data = DataModel.SelectData;

        if (data.Id == 0)
        {
            return;
        }
        if (data.IsReceive == 1)
        {
            //邮件已经领取
            var e = new ShowUIHintBoard(3200001);
            EventDispatcher.Instance.DispatchEvent(e);
            return;
        }
        if (data.IsAttach == false)
        {
            EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(419));
            return;
        }
        var mials = new Uint64Array();

        mials.Items.Add(data.Id);
        NetManager.Instance.StartCoroutine(ReceiveMailsCoroutine(mials));
    }
Esempio n. 15
0
    //请求邮件
    public IEnumerator ApplyMailsCoroutine(MailCellData data)
    {
        using (new BlockingLayerHelper(0))
        {
            var msg = NetManager.Instance.ApplyMailInfo(data.Id);
            yield return(msg.SendAndWaitUntilDone());

            if (msg.State == MessageState.Reply)
            {
                if (msg.ErrorCode == (int)ErrorCodes.OK)
                {
                    var mailInfo = msg.Response;
                    data.State = mailInfo.State;
                    var content = GameUtils.ConvertChatContent(mailInfo.Text);
                    data.InfoData.Content = content.Replace("\\n", "\n");
                    data.InfoData.Sender  = mailInfo.Send;
                    var index = 0;
                    if (data.IsReceive != 1)
                    {
                        {
                            var __list9      = mailInfo.Items;
                            var __listCount9 = __list9.Count;
                            for (var __i9 = 0; __i9 < __listCount9; ++__i9)
                            {
                                var i = __list9[__i9];
                                {
                                    data.InfoData.Items[index].ItemId = i.ItemId;
                                    data.InfoData.Items[index].Count  = i.Count;
                                    data.InfoData.Items[index].Exdata.InstallData(i.Exdata);
                                    index++;
                                }
                            }
                        }
                    }
                    for (var i = index; i < 5; i++)
                    {
                        data.InfoData.Items[i].Reset();
                    }
                    DataModel.SelectData.IsApply = true;
                    AnalyseNotice();
                }
                else if (msg.ErrorCode == (int)ErrorCodes.Error_MailNotFind)
                {
                    //邮件没有找到
                    var e = new ShowUIHintBoard(msg.ErrorCode + 200000000);
                    EventDispatcher.Instance.DispatchEvent(e);
                }
                else
                {
                    UIManager.Instance.ShowNetError(msg.ErrorCode);
                    Logger.Error("ApplyMailInfo Error!............ErrorCode..." + msg.ErrorCode);
                }
            }
            else
            {
                Logger.Error("ApplyMailInfo Error!............State..." + msg.State);
            }
        }
    }
Esempio n. 16
0
        private IEnumerator RespectRoleCoroutine()
        {
            using (new BlockingLayerHelper(0))
            {
                var _charId = DataModel.SelectCellData.CharacterId;
                var _msg    = NetManager.Instance.WorshipCharacter(_charId);
                var _count  = DataModel.SelfWorshipCount;
                yield return(_msg.SendAndWaitUntilDone());

                if (_msg.State == MessageState.Reply)
                {
                    if (_msg.ErrorCode == (int)ErrorCodes.OK)
                    {
                        DataModel.TargetWorshipCount++;
                        var _playerInfo = PlayerDataManager.Instance.GetCharacterSimpleInfo(_charId);
                        if (_playerInfo != null)
                        {
                            _playerInfo.WorshipCount++;

                            var _animationId = GameUtils.RankWorshipAction[_playerInfo.TypeId];
                            var _e           = new RankNotifyLogic(1, _animationId);
                            EventDispatcher.Instance.DispatchEvent(_e);
                        }
                        if (DataModel.SelfWorshipCount != _count + 1)
                        {
                            DataModel.SelfWorshipCount = _count + 1;
                        }
                        if (DataModel.SelfWorshipCount >= DataModel.WorshipCountMax)
                        {
                            PlayerDataManager.Instance.NoticeData.RankingCanLike = false;
                        }
                    }
                    else if (_msg.ErrorCode == (int)ErrorCodes.Error_CharacterSame)
                    {
                        var _e = new ShowUIHintBoard(220501);
                        EventDispatcher.Instance.DispatchEvent(_e);
                    }
                    else if (_msg.ErrorCode == (int)ErrorCodes.Error_WorshipAlready)
                    {
                        var _e = new ShowUIHintBoard(3000001);
                        EventDispatcher.Instance.DispatchEvent(_e);
                    }
                    else if (_msg.ErrorCode == (int)ErrorCodes.Error_WorshipCount)
                    {
                        var _e = new ShowUIHintBoard(3000002);
                        EventDispatcher.Instance.DispatchEvent(_e);
                    }
                    else
                    {
                        UIManager.Instance.ShowNetError(_msg.ErrorCode);
                        Logger.Error("WorshipCharacter Error!............ErrorCode..." + _msg.ErrorCode);
                    }
                }
                else
                {
                    Logger.Error("WorshipCharacter Error!............State..." + _msg.State);
                }
            }
        }
Esempio n. 17
0
    public IEnumerator ComposeItemCoroutine()
    {
        using (new BlockingLayerHelper(0))
        {
            var composeCount = PlayerDataManager.Instance.GetExData((int)eExdataDefine.e415);
            var msg          = NetManager.Instance.ComposeItem(DataModel.SelectIndex, 1);
            yield return(msg.SendAndWaitUntilDone());

            if (msg.State == MessageState.Reply)
            {
                if (msg.ErrorCode == (int)ErrorCodes.OK)
                {
                    if (msg.Response == -1)
                    {
                        EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(454));
                    }
                    else
                    {
                        PlatformHelper.Event("city", "compose", DataModel.SelectIndex);
                        //合成前几次获得经验
                        //                         if (BuildingData != null)
                        //                         {
                        //                             var tbBuilding = Table.GetBuilding(BuildingData.TypeId);
                        //                             var tbServer = Table.GetBuildingService(tbBuilding.ServiceId);
                        //                             if (composeCount < tbServer.Param[3])
                        //                             {
                        //                                 EventDispatcher.Instance.DispatchEvent(new UIEvent_ComposeFlyAnim(tbServer.Param[2]));
                        //                             }
                        //                         }
                        EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(453));
                    }
                    EventDispatcher.Instance.DispatchEvent(new ComposeItemEffectEvent(msg.Response != -1));
                }
                else if (msg.ErrorCode == (int)ErrorCodes.Error_ItemNoInBag_All)
                {
                    var e = new ShowUIHintBoard(300116);
                    EventDispatcher.Instance.DispatchEvent(e);
                }
                else if (msg.ErrorCode == (int)ErrorCodes.Error_ItemComposeID ||
                         msg.ErrorCode == (int)ErrorCodes.ItemNotEnough ||
                         msg.ErrorCode == (int)ErrorCodes.MoneyNotEnough)
                {
                    var e = new ShowUIHintBoard(msg.ErrorCode + 200000000);
                    EventDispatcher.Instance.DispatchEvent(e);
                }
                else
                {
                    var e = new ShowUIHintBoard(msg.ErrorCode + 200000000);
                    EventDispatcher.Instance.DispatchEvent(e);
                    Logger.Debug("ComposeItem..................." + msg.ErrorCode);
                }
            }
            else
            {
                Logger.Debug("ComposeItem..................." + msg.State);
            }
        }
    }
Esempio n. 18
0
        public void OnCleanFinish()
        {
            //挑战成功
            EffecTexture.SetFlow(true);

            var e1 = new ShowUIHintBoard(270004);

            EventDispatcher.Instance.DispatchEvent(e1);
            NetManager.Instance.StartCoroutine(ShowCleanFinish());
        }
Esempio n. 19
0
    public void ShowDictionaryTip(string strDic, bool addChat)
    {
        var e = new ShowUIHintBoard(strDic);

        EventDispatcher.Instance.DispatchEvent(e);

        if (addChat)
        {
            var e1 = new ChatMainHelpMeesage(strDic);
            EventDispatcher.Instance.DispatchEvent(e1);
        }
    }
Esempio n. 20
0
        private void EnterSceneEvent(IEvent iev)
        {
            //if (DataModel.ItemList[DataModel.CurrentSelectPageIdx].isGrey)
            //{
            //    Debug.LogError("Boss已死"); return;
            //}
            if (PlayerDataManager.Instance.GetRes((int)eResourcesType.LevelRes) < DataModel.NeedLevel)
            {
                var _ee = new ShowUIHintBoard(210207);
                EventDispatcher.Instance.DispatchEvent(_ee);
                return;
            }
            if (PlayerDataManager.Instance.GetRes((int)eResourcesType.DiamondRes) < costDiamo)
            {
                var _e = new Show_UI_Event(UIConfig.RechargeFrame, new RechargeFrameArguments {
                    Tab = 0
                });
                EventDispatcher.Instance.DispatchEvent(_e);
                return;
            }
            if (PlayerDataManager.Instance.GetRes((int)eResourcesType.VipLevel) < viplimit)
            {
                UIManager.Instance.ShowMessage(MessageBoxType.OkCancel, string.Format(GameUtils.GetDictionaryText(270247), viplimit), "",
                                               () => {
                    var _e = new Show_UI_Event(UIConfig.RechargeFrame, new RechargeFrameArguments {
                        Tab = 0
                    });
                    EventDispatcher.Instance.DispatchEvent(_e);
                });
                return;
            }
            var tbScene = GameLogic.Instance.Scene.TableScene;

            if (tbScene == null)
            {
                return;
            }
            if (tbScene.Id == homeSceneId)
            {
                EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(270081));
                return;
            }
            //var diamond = PlayerDataManager.Instance.PlayerDataModel.Bags.Resources.Diamond - costDiamo;
            //PlayerDataManager.Instance.SetRes(3, diamond);
            var scene = GameLogic.Instance.Scene;

            if (scene.TableScene.Type != (int)eSceneType.Fuben)
            {
                DataModel.ModelId = -1;
            }
//            NetManager.Instance.StartCoroutine(ApplyBossHomeCostCoroutine());
            GameUtils.EnterFuben(homeSceneId);
        }
Esempio n. 21
0
    public IEnumerator StoreBuyCoroutine(int index, int count = 1)
    {
        using (new BlockingLayerHelper(0))
        {
            var msg = NetManager.Instance.StoreBuy(index, count, (int)NpcService.NsShop);
            yield return(msg.SendAndWaitUntilDone());

            if (msg.State == MessageState.Reply)
            {
                if (DataModel.Type != 2)
                {
                    EventDispatcher.Instance.DispatchEvent(new Close_UI_Event(UIConfig.QuickBuyUi));
                }

                if (msg.ErrorCode == (int)ErrorCodes.OK)
                {
                    var tbStore = Table.GetStore(index);
                    //购买成功
                    EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(431));

                    if (tbStore == null)
                    {
                        yield break;
                    }
                    var flagId = tbStore.BugSign;
                    if (flagId != -1)
                    {
                        var flag = PlayerDataManager.Instance.GetFlag(flagId);
                        if (flag == false)
                        {
                            PlayerDataManager.Instance.SetFlag(flagId, true);
                        }
                    }

                    PlatformHelper.UMEvent("BuyItem", tbStore.Name, count);
                }
                else if (msg.ErrorCode == (int)ErrorCodes.Error_ItemNoInBag_All)
                {
                    var e = new ShowUIHintBoard(430);
                    EventDispatcher.Instance.DispatchEvent(e);
                }
                else
                {
                    UIManager.Instance.ShowNetError(msg.ErrorCode);
                    Logger.Error("QuickBuy StoreBuy....StoreId= {0}...ErrorCode...{1}", index, msg.ErrorCode);
                }
            }
            else
            {
                Logger.Error("QuickBuy StoreBuy............State..." + msg.State);
            }
        }
    }
Esempio n. 22
0
    public IEnumerator UseBuildServiceCoroutine(Int32Array param, Action onOk)
    {
        yield return(null);

        using (new BlockingLayerHelper(0))
        {
            var tbBuilding = Table.GetBuilding(BuildingData.TypeId);

            var msg = NetManager.Instance.UseBuildService(BuildingData.AreaId, tbBuilding.ServiceId, param);
            yield return(msg.SendAndWaitUntilDone());

            if (msg.State == MessageState.Reply)
            {
                if (msg.ErrorCode == (int)ErrorCodes.OK)
                {
                    if (param.Items[0] == 3) //装备进阶功能
                    {
                        var list = DataModel.AdvanceDataModel.EvolveItems;
                        for (var i = 0; i < list.Count; i++)
                        {
                            if (list[i].ItemId != -1)
                            {
                                var equipLogic = Table.GetEquipBase(list[i].ItemId).EquipUpdateLogic;
                                var count      = Table.GetEquipUpdate(equipLogic).SuccessGetExp;
                                EventDispatcher.Instance.DispatchEvent(new UIEvent_SmithyFlyAnim(1, count));
                            }
                        }

                        isBagDirty = true;
                        GameUtils.ShowEquipModel(DataModel.AdvanceDataModel.EvolvedItemId);
                    }
                    if (onOk != null)
                    {
                        onOk();
                    }
                }
                else
                {
                    UIManager.Instance.ShowNetError(msg.ErrorCode);
                    //mRefreshEvoUiAction = null;
                }
            }
            else
            {
                var e = new ShowUIHintBoard(220821);
                EventDispatcher.Instance.DispatchEvent(e);
                //mRefreshEvoUiAction = null;
            }
        }
    }
Esempio n. 23
0
        public void OnPuzzleFinish()
        {
            //挑战成功

            EffecttTween.gameObject.SetActive(true);
            EffecttTween.ResetToBeginning();
            EffecttTween.PlayForward();
            EffectParticle.gameObject.SetActive(true);

            var e1 = new ShowUIHintBoard(270004);

            EventDispatcher.Instance.DispatchEvent(e1);
            NetManager.Instance.StartCoroutine(ShowPuzzleFinish());
        }
Esempio n. 24
0
 private void ShowBattleUI()
 {
     if (PlayerDataManager.Instance.GetExData(eExdataDefine.e282) <= 0)
     {
         //先加入公会才能参加城战
         var e = new ShowUIHintBoard(270289);
         EventDispatcher.Instance.DispatchEvent(e);
         return;
     }
     EventDispatcher.Instance.DispatchEvent(new Show_UI_Event(UIConfig.BattleUnionUI,
                                                              new BattleUnionArguments {
         Tab = 5
     }));
 }
Esempio n. 25
0
    public void OnPackUnlock(IEvent ievent)
    {
        var e       = ievent as PackUnlockEvent;
        var bagItem = e.DataModel;
        var bagId   = bagItem.BagId;

        if (bagId == (int)eBagType.FarmDepot)
        {
            var e1 = new ShowUIHintBoard(300300);
            EventDispatcher.Instance.DispatchEvent(e1);
            return;
        }
        var index = bagItem.Index;

        BuyBagCapacity(bagId, index);
    }
Esempio n. 26
0
 private void RebornGuard()
 {
     if (DataModel.RebornCount <= 0)
     {
         // "守卫已经复活了20次,无法继续复活!"
         var ee = new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(271000), 20));
         EventDispatcher.Instance.DispatchEvent(ee);
         return;
     }
     if (DataModel.NeedDiaCount > PlayerDataManager.Instance.GetRes((int)eResourcesType.DiamondRes))
     {
         var ee = new ShowUIHintBoard(300401);
         EventDispatcher.Instance.DispatchEvent(ee);
         return;
     }
     NetManager.Instance.StartCoroutine(AllianceWarRespawnGuard(_mSelectedIndex));
 }
Esempio n. 27
0
    public IEnumerator ComposeBookCard(int id)
    {
        using (new BlockingLayerHelper(0))
        {
            var composeCount = 1;
            var msg          = NetManager.Instance.ComposeItem(id, composeCount);
            yield return(msg.SendAndWaitUntilDone());

            if (msg.State == MessageState.Reply)
            {
                if (msg.ErrorCode == (int)ErrorCodes.OK)
                {
                    var selectBook = mHandBookDataModel.SelectedBook[0];
                    var castBook   = mHandBookDataModel.SelectedBook[1];
                    castBook.BookCount -= selectBook.UpGradeRequestCount;
                    selectBook.BookCount++;
                    HandBookItemDataModel book;
                    if (mBooksCacheDic.TryGetValue(castBook.BookId, out book))
                    {
                        book.BookCount = castBook.BookCount;
                    }
                    else
                    {
                        Logger.Error("ComposeBookCard error, bookinfo: " + castBook.BookId + "do not exist!");
                    }

                    if (mBooksCacheDic.TryGetValue(selectBook.BookId, out book))
                    {
                        book.BookCount = selectBook.BookCount;
                    }
                    else
                    {
                        Logger.Error("ComposeBookCard error, bookinfo: " + selectBook.BookId + "do not exist!");
                    }

                    RefreshNotice();
                    var ee = new ShowUIHintBoard(200010);
                    EventDispatcher.Instance.DispatchEvent(ee);
                }
                else
                {
                    UIManager.Instance.ShowNetError(msg.ErrorCode);
                }
            }
        }
    }
Esempio n. 28
0
    public IEnumerator SendAddTalentPointMassage(int talentId)
    {
        using (new BlockingLayerHelper(0))
        {
            var msg = NetManager.Instance.UpgradeInnate(talentId);
            yield return(msg.SendAndWaitUntilDone());

            if (msg.State == MessageState.Reply)
            {
                if (msg.ErrorCode == (int)ErrorCodes.OK)
                {
                    PlatformHelper.Event("skill", "addInnate");
                    PlatformHelper.UMEvent("skill", "addInnate");
                    ChangeTalentCountToDataModel(talentId);
                    if (Table.GetTalent(talentId).ModifySkill == -1)
                    {
                        SkillDataModel.TalentResetButtonShow = true;
                        PlayerAttr.Instance.SetAttrChange(PlayerAttr.PlayerAttrChange.Talant);
                    }
                }
                else
                {
                    if (msg.ErrorCode == (int)ErrorCodes.Error_InnateNoPoint)
                    {
                        var e = new ShowUIHintBoard(706);
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                    else if (msg.ErrorCode == (int)ErrorCodes.Error_InnateNoBefore)
                    {
                        var e = new ShowUIHintBoard(705);
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                    else if (msg.ErrorCode == (int)ErrorCodes.Error_ResNoEnough)
                    {
                        var ee = new ShowUIHintBoard(210108);
                        EventDispatcher.Instance.DispatchEvent(ee);
                    }
                    else
                    {
                        UIManager.Instance.ShowNetError(msg.ErrorCode);
                    }
                }
            }
        }
    }
Esempio n. 29
0
        private void RefreshAttrPoint()
        {
            var count = 0;

            for (var i = 5; i <= 8; i++)
            {
                count += PlayerDataManager.Instance.GetExData(i);
            }
            if (count == 0)
            {
                var e = new ShowUIHintBoard("");
                EventDispatcher.Instance.DispatchEvent(e);
                return;
            }
            //是否确定洗点?
            UIManager.Instance.ShowMessage(MessageBoxType.OkCancel, 270217, "",
                                           () => { NetManager.Instance.StartCoroutine(ResetCoroutine()); });
        }
Esempio n. 30
0
    public void OnGetBookClick(IEvent ievent)
    {
        if (mHandBookDataModel.BookInfoShow == 1)
        {
            var itemData = mHandBookDataModel.SelectedBook[0];
            //21去打怪获取
            if (21 == itemData.TrackType)
            {
                ObjManager.Instance.MyPlayer.LeaveAutoCombat();
                GameControl.Executer.Stop();
                var command = GameControl.GoToCommand(itemData.TrackParam[0], itemData.TrackParam[1],
                                                      itemData.TrackParam[2]);
                var command1 = new FuncCommand(() =>
                {
                    GameControl.Instance.TargetObj = null;
                    ObjManager.Instance.MyPlayer.EnterAutoCombat();
                });
                GameControl.Executer.PushCommand(command);
                GameControl.Executer.PushCommand(command1);
                EventDispatcher.Instance.DispatchEvent(new Close_UI_Event(UIConfig.HandBook));
            }
            else if (22 == itemData.TrackType)
            {
                var e = new Show_UI_Event(UIConfig.DungeonUI);
                EventDispatcher.Instance.DispatchEvent(e);

                GameUtils.GotoUiTab(25, itemData.TrackParam[0]);
            }
            else if (23 == itemData.TrackType)
            {
                var dicid = itemData.TrackParam[0];
                if (dicid > 0)
                {
                    var ee = new ShowUIHintBoard(dicid);
                    EventDispatcher.Instance.DispatchEvent(ee);
                }
            }
            else if (23 == itemData.TrackType)
            {
                var ee = new ShowUIHintBoard(itemData.TrackParam[1]);
                EventDispatcher.Instance.DispatchEvent(ee);
            }
        }
    }