Пример #1
0
        /// <summary>
        /// 副连接心跳包更新
        /// </summary>
        void OnCrossHeartTimeUpdate()
        {
            //GameDebug.Log("<<<MSG_ACC_HEART_MWAR:" + Time.unscaledTime);
            var cross_acc_heart = new C2SAccHeartMwar();

            NetClient.GetCrossClient().SendData <C2SAccHeartMwar>(NetMsg.MSG_ACC_HEART_MWAR, cross_acc_heart);
            if (mCrossHeartTimeout != null)
            {
                mCrossHeartTimeout.Destroy();
                mCrossHeartTimeout = null;
            }

            mCrossHeartTimeout = new Utils.Timer(GameConstHelper.GetInt("GAME_SYS_PING_TIMEOUT") * 1000, false, GameConstHelper.GetInt("GAME_SYS_PING_TIMEOUT") * 1000.0f, OnCrossHeartTimeout);
        }
Пример #2
0
        /// <summary>
        /// 主连接心跳包的更新
        /// </summary>
        void OnHeartTimeUpdate()
        {
            //GameDebug.Log("<<<MSG_ACC_HEART:"+Time.unscaledTime);
            mLastPingTime = UnityEngine.Time.realtimeSinceStartup;

            C2SAccHeart acc_heart = new C2SAccHeart();

            NetClient.GetBaseClient().SendData <C2SAccHeart>(NetMsg.MSG_ACC_HEART, acc_heart);
            if (m_HeartTimeout != null)
            {
                m_HeartTimeout.Destroy();
                m_HeartTimeout = null;
            }

            m_HeartTimeout = new Utils.Timer(GameConstHelper.GetInt("GAME_SYS_PING_TIMEOUT") * 1000, false, GameConstHelper.GetInt("GAME_SYS_PING_TIMEOUT") * 1000.0f, OnHeartTimeout);
        }
Пример #3
0
 public void Reset()
 {
     PKValue  = 0;
     mPKValue = 0;
     mPKMode  = GameConst.PK_MODE_PEACE;
     IsPKProtectionTeamMate                = true;
     IsPKProtectionSociety                 = true;
     IsPKProtectionGreenName               = true;
     PKProtectionLv                        = GameConstHelper.GetUint("GAME_PK_MIN");
     mGamePKLvProtect                      = GameConstHelper.GetInt("GAME_PK_LV_PROTECT");
     m_hostileAttackMap                    = new Dictionary <uint, float>();
     m_hostileAttackTipsInterval           = GameConstHelper.GetInt("GAME_PK_HOSTILEATTACK_TIPS_INTERVAL");
     m_gamePKReviveBuffId                  = GameConstHelper.GetUint("GAME_PK_REVIVE_BUFF_ID");
     m_gamePVPBloodDelayDisappearInterval  = GameConstHelper.GetUint("GAME_BF_PVP_BLOOD_DELAY_DISAPPEAR_INTERVAL");
     m_game_wboss_lv_no_drop               = GameConstHelper.GetUint("GAME_WBOSS_AFFILI_LV_NO_DROP");
     m_game_wboss_lv_no_drop_tips_interval = GameConstHelper.GetUint("GAME_WBOSS_AFFILI_LV_ON_DROP_CD_INTERVAL");
     m_gameEnterPVPStateInterval           = GameConstHelper.GetUint("GAME_PK_ENTER_PVP_PK_INTERVAL");
 }
Пример #4
0
        public void AddStrange(FriendsInfo info, bool first)
        {
            bool isNew = false;
            List <FriendsInfo> friendList = null;

            if (mCommon.TryGetValue(FriendType.Closer, out friendList) == false)
            {
                friendList = new  List <FriendsInfo>();
                mCommon.Add(FriendType.Closer, friendList);
            }

            var have = friendList.Find(delegate(FriendsInfo _info){
                return(_info.Uid == info.Uid);
            });

            isNew = have == null;

            if (have != null)
            {
                friendList.Remove(have);
            }

            info.IsFirst      = first;
            info.LastChatTime = Game.Instance.ServerTime + 1;

            int closerInt = GameConstHelper.GetInt("GAME_CLOSER_NUM_LIMIT");

            if (friendList.Count >= closerInt)
            {
                friendList.RemoveAt(friendList.Count - 1);
            }

            friendList.Sort(CompareInfo2);
            friendList.Insert(0, info);
            ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_FRIENDS_CHANGE, new CEventBaseArgs(FriendType.Closer));

            if (isNew)
            {
                SaveCloser();
            }
        }
Пример #5
0
        public IAudioTrack GetAudioTrack(SoundType type)
        {
            IAudioTrack audio;

            if (!audioTrack.TryGetValue(type, out audio))
            {
                AudioMixerGroup audioMixerGroup;
                audioMixerGroups.TryGetValue(type.ToString(), out audioMixerGroup);
                switch (type)
                {
                case SoundType.LocalPlayer:
                    audio = new NormalTrack(go, audioMixerGroup);
                    break;

                case SoundType.Boss:
                case SoundType.Monster:
                    audio = new FrequencyAndQuantityLimit(go, audioMixerGroup, GameConstHelper.GetInt("MONSTER_GROUP_SOUND_NUM"), GameConstHelper.GetFloat("MONSTER_GROUP_SOUND_INTERVAL"));
                    break;

                case SoundType.Voice:
                    audio = new OneClipPerTime(go, audioMixerGroup);
                    break;

                case SoundType.NPC:
                    audioMixerGroups.TryGetValue(SoundType.Voice.ToString(), out audioMixerGroup);
                    audio = new OneClipPerTimeInterruption(go, audioMixerGroup);
                    break;

                default:
                    audio = new NormalTrack(go, audioMixerGroup);
                    break;
                }

                audioTrack.Add(type, audio);
            }
            return(audio);
        }
Пример #6
0
        /// <summary>
        /// 增加buff的特效
        /// </summary>
        public void AddEffectObj(DBBuffSev.DBBuffInfo buff_info)
        {
            if (buff_info == null)
            {
                return;
            }

            if (mEffectObjs.ContainsKey(buff_info.buff_id))
            {
                return;
            }

            if (buff_info.effect_file == string.Empty)
            {
                return;
            }

            int effect_max_count = GameConstHelper.GetInt("GAME_BUFF_EFFECT_MAX_COUNT");

            if (effect_max_count == 0)
            {
                effect_max_count = 5;
            }

            bool can_show = true;

            if (buff_info.other_hide) // 其他玩家需要隐藏的特效
            {
                can_show = !ShieldManager.Instance.IsHideBuffEffect(mOwner);
            }

            if (can_show && buff_info.force_show == false)// 需要通过顶替规则进行显示的特效
            {
                // 统计当前可能被顶替的特效数量
                int  current_count     = 0;
                uint low_priority_buff = 0;
                uint low_priority      = uint.MaxValue;
                bool del_low_priority  = false;
                foreach (uint id in mEffectObjs.Keys)
                {
                    DBBuffSev.DBBuffInfo t_buff_info = DBBuffSev.GetInstance().GetBuffInfo(id);
                    if (t_buff_info.force_show == false)
                    {
                        if (buff_info.priority > t_buff_info.priority) //可顶替
                        {
                            if (low_priority > t_buff_info.priority)   // 寻找最低优先级的特效
                            {
                                low_priority      = t_buff_info.priority;
                                low_priority_buff = id;
                            }
                        }

                        current_count++;
                    }

                    if (current_count >= effect_max_count)
                    {
                        del_low_priority = true;
                    }
                }

                if (del_low_priority)
                {
                    if (low_priority_buff != 0)
                    {
                        DestroyEffectObj(low_priority_buff);
                    }
                    else
                    {
                        can_show = false;
                    }
                }
            }

            if (can_show)
            {
                BindEffectInfo new_effect = mOwner.InitBindEffectInfo(buff_info.effect_file, buff_info.bind_pos, buff_info.follow_target, buff_info.scale, buff_info.auto_scale, buff_info.max_count);

                new_effect.CreateInstance();
                mEffectObjs.Add(buff_info.buff_id, new_effect);
            }
        }
Пример #7
0
 public NetReconnect()
 {
     InitMachine();
     InitEvent();
     m_HeartInterval = GameConstHelper.GetInt("GAME_SYS_HEART_INTERVAL");
 }
Пример #8
0
        public static void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_TASK_INFO:
            {
                S2CTaskInfo pack = S2CPackBase.DeserializePack <S2CTaskInfo>(data);

                // 首先所有任务的置顶取消
                foreach (Task task in TaskManager.Instance.AllTasks)
                {
                    task.IsOnTop = false;
                }

                IsFirstReceiveTaskInfo = !Game.Instance.AllSystemInited;

                List <Task> newTasks = new List <Task>();
                newTasks.Clear();
                List <Task> finishedTasks = new List <Task>();
                finishedTasks.Clear();
                List <Task> newAcceptTasks = new List <Task>();
                newAcceptTasks.Clear();
                List <Task> doneTasks = new List <Task>();
                doneTasks.Clear();
                List <Task> tasksToGuide = new List <Task>();
                tasksToGuide.Clear();
                bool isTitleTaskChanged  = false;           // 头衔任务是否改变
                bool isEscortTaskChanged = false;           // 护送任务是否改变
                foreach (PkgTaskInfo taskInfo in pack.tasks)
                {
                    bool isNewTask = false;
                    if (TaskManager.Instance.HasTask(taskInfo.id))
                    {
                        TaskManager.Instance.DeleteTask(taskInfo.id);
                    }
                    else
                    {
                        isNewTask = true;
                    }

                    var dbTask = TaskDefine.MakeDefine(taskInfo.id);
                    if (dbTask == null)
                    {
                        GameDebug.LogError("Error!!! Can not find task data in db by id " + taskInfo.id);
                        continue;
                    }

                    Task task = new Task(dbTask);

                    uint index = 1;
                    foreach (var step in dbTask.Steps)
                    {
                        Task.StepProgress stepProgress = new Task.StepProgress();
                        stepProgress.StepId = index;
                        if (taskInfo.value.Count > 0)
                        {
                            stepProgress.CurrentValue = taskInfo.value[0];
                        }
                        else
                        {
                            stepProgress.CurrentValue = 0;
                        }

                        task.StepProgresss.Add(stepProgress);

                        ++index;
                    }

                    task.StepProgresss.Sort();
                    task.State     = taskInfo.state;
                    task.StartTime = taskInfo.start_time;
                    if (taskInfo.step > 0)
                    {
                        task.CurrentStepIndex = taskInfo.step - 1;
                    }
                    else
                    {
                        task.CurrentStepIndex = 0;
                    }

                    // 提高任务显示优先级
                    if (IsFirstReceiveTaskInfo == false)
                    {
                        // 头衔任务不受动态排序规则影响
                        if (task.Define.Type != GameConst.QUEST_TITLE)
                        {
                            Task.IncreaseCurDynamicShowPriority();
                            task.DynamicShowPriority = Task.CurDynamicShowPriority;
                        }
                    }

                    TaskManager.Instance.AddTask(task);

                    if (task.State == GameConst.QUEST_STATE_DONE)
                    {
                        Task.StepProgress   stepProgress = task.CurrentStepProgress;
                        TaskDefine.TaskStep curStep      = task.CurrentStep;
                        if (stepProgress != null && curStep != null)
                        {
                            stepProgress.CurrentValue = curStep.ExpectResult;
                        }
                    }

                    // 是否是新接取的任务
                    if (IsFirstReceiveTaskInfo == false && task.State == GameConst.QUEST_STATE_DOING)
                    {
                        if (task.CurrentStepProgress != null && task.CurrentStepProgress.CurrentValue == 0)
                        {
                            newAcceptTasks.Add(task);
                        }
                    }

                    // 是否自动执行,进入游戏首次收到这个消息不执行副本状态下不执行,新任务不执行,不是在追踪状态的任务不执行
                    if (IsFirstReceiveTaskInfo == false && SceneHelp.Instance.IsInNormalWild() == true && task.Define.AutoRunType != TaskDefine.EAutoRunType.None)
                    {
                        // 不可接或者失效的任务不可自动执行
                        if (taskInfo.state != GameConst.QUEST_STATE_UNACCEPT && taskInfo.state != GameConst.QUEST_STATE_INVALID)
                        {
                            if ((task.Define.AutoRunType == TaskDefine.EAutoRunType.AutoRun && InstanceManager.Instance.IsOnHook == false) || task.Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun)
                            {
                                // 如果当前正在导航的任务的自动执行是ForceAutoRun2,则其他任务的自动执行不会打断它
                                Task navigatingTask = TaskManager.Instance.NavigatingTask;
                                if (navigatingTask == null || navigatingTask.Define.AutoRunType != TaskDefine.EAutoRunType.ForceAutoRun2)
                                {
                                    if (taskInfo.state == GameConst.QUEST_STATE_DOING || taskInfo.state == GameConst.QUEST_STATE_DONE)
                                    {
                                        tasksToGuide.Add(task);
                                    }
                                }
                            }
                            else if (task.Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun2)
                            {
                                tasksToGuide.Add(task);
                            }
                        }
                    }

                    if (IsFirstReceiveTaskInfo == false)
                    {
                        if (taskInfo.state == GameConst.QUEST_STATE_FIN)
                        {
                            finishedTasks.Add(task);
                        }
                    }

                    if (IsFirstReceiveTaskInfo == false)
                    {
                        if (taskInfo.state == GameConst.QUEST_STATE_DONE)
                        {
                            doneTasks.Add(task);
                        }
                    }

                    // 任务进度飘字
                    if (isNewTask == false && taskInfo.state == GameConst.QUEST_STATE_DONE)
                    {
                        TaskHelper.ShowTaskProgressTips(task);
                    }

                    if (IsFirstReceiveTaskInfo == false && isNewTask == true)
                    {
                        newTasks.Add(task);
                    }

                    if (task.Define.Type == GameConst.QUEST_TITLE)
                    {
                        isTitleTaskChanged = true;
                    }
                    if (task.Define.Type == GameConst.QUEST_ESCORT)
                    {
                        isEscortTaskChanged = true;
                    }
                }

                //TaskManager.Instance.SortTaskList();

                //ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_CHANGED, null);
                StartTaskChangedCoroutine();

                if (isTitleTaskChanged == true)
                {
                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.TITLE_TASK_CHANGED, null);
                }
                if (isEscortTaskChanged == true)
                {
                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.ESCORT_TASK_CHANGED, null);
                }

                if (finishedTasks.Count > 0)
                {
                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_FINISHED, new CEventBaseArgs(finishedTasks[0].Define.Id));

                    if (finishedTasks[0].Define.SubmitedTimelineId > 0)
                    {
                        // 是否是婚宴剧情动画
                        if (finishedTasks[0].Define.SubmitedTimelineId == GameConstHelper.GetUint("GAME_WEDDING_DRAMA_TIMELINE_ID_1"))
                        {
                            TimelineManager.Instance.PlayWeddingChapelTimeline();
                        }
                        else
                        {
                            TimelineManager.Instance.Play(finishedTasks[0].Define.SubmitedTimelineId);
                        }
                    }
                }

                if (newAcceptTasks.Count > 0)
                {
                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_NEW_ACCEPTED, new CEventBaseArgs(newAcceptTasks[0].Define.Id));

                    if (newAcceptTasks[0].Define.ReceivedTimelineId > 0)
                    {
                        // 是否是婚宴剧情动画
                        if (newAcceptTasks[0].Define.ReceivedTimelineId == GameConstHelper.GetUint("GAME_WEDDING_DRAMA_TIMELINE_ID_1"))
                        {
                            TimelineManager.Instance.PlayWeddingChapelTimeline();
                        }
                        else
                        {
                            TimelineManager.Instance.Play(newAcceptTasks[0].Define.ReceivedTimelineId);
                        }
                    }

                    // 如果在副本里面接受了AutoRun的赏金任务或者帮派任务,则Post一个TASK_GUIDE的event,等退出副本再次导航这个任务
                    if (SceneHelp.Instance.IsInInstance == true)
                    {
                        if ((newAcceptTasks[0].Define.AutoRunType == TaskDefine.EAutoRunType.AutoRun && InstanceManager.Instance.IsOnHook == false) || newAcceptTasks[0].Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun || newAcceptTasks[0].Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun2)
                        {
                            BountyTaskInfo bountyTaskInfo = TaskManager.Instance.BountyTaskInfo;
                            GuildTaskInfo  guildTaskInfo  = TaskManager.Instance.GuildTaskInfo;

                            // bountyTaskInfo.id == 0即首次接取赏金任务时不自动执行
                            if (newAcceptTasks[0].Define.Type == GameConst.QUEST_SG && !(bountyTaskInfo != null && bountyTaskInfo.id == 0))
                            {
                                ClientEventMgr.GetInstance().PostEvent((int)ClientEvent.TASK_GUIDE, new CEventBaseArgs(newAcceptTasks[0].Define.Id));
                            }
                            // guildTaskInfo.id == 0即首次接取帮派任务时不自动执行
                            else if (newAcceptTasks[0].Define.Type == GameConst.QUEST_GUILD && !(guildTaskInfo != null && guildTaskInfo.id == 0))
                            {
                                ClientEventMgr.GetInstance().PostEvent((int)ClientEvent.TASK_GUIDE, new CEventBaseArgs(newAcceptTasks[0].Define.Id));
                            }
                        }
                    }
                }

                if (doneTasks.Count > 0)
                {
                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_CAN_SUBMIT, new CEventBaseArgs(doneTasks));
                }

                if (SceneHelp.Instance.IsInNormalWild() == true)
                {
                    if (tasksToGuide.Count > 0)
                    {
                        BountyTaskInfo bountyTaskInfo = TaskManager.Instance.BountyTaskInfo;
                        GuildTaskInfo  guildTaskInfo  = TaskManager.Instance.GuildTaskInfo;

                        // DoNotAutoRunBountyTaskNextTime为true不自动执行,bountyTaskInfo.id == 0即首次接取赏金任务时不自动执行
                        if (tasksToGuide[0].Define.Type == GameConst.QUEST_SG && (TaskManager.Instance.DoNotAutoRunBountyTaskNextTime == true || (bountyTaskInfo != null && bountyTaskInfo.id == 0)))
                        {
                            TaskManager.Instance.DoNotAutoRunBountyTaskNextTime = false;
                        }
                        // DoNotAutoRunGuildTaskNextTime为true不自动执行,guildTaskInfo.id == 0即首次接取帮派任务时不自动执行
                        else if (tasksToGuide[0].Define.Type == GameConst.QUEST_GUILD && (TaskManager.Instance.DoNotAutoRunGuildTaskNextTime == true || (guildTaskInfo != null && guildTaskInfo.id == 0)))
                        {
                            TaskManager.Instance.DoNotAutoRunGuildTaskNextTime = false;
                        }
                        else
                        {
                            // 正在主线任务导航的时候,则不能自动执行其他类型的任务
                            if ((TaskManager.Instance.IsNavigatingMainTask == false && TaskHelper.MainTaskIsInGuideCoroutine == false) || tasksToGuide[0].Define.Type == GameConst.QUEST_MAIN)
                            {
                                if (tasksToGuide[0].State != GameConst.QUEST_STATE_UNACCEPT && tasksToGuide[0].State != GameConst.QUEST_STATE_FIN && tasksToGuide[0].State != GameConst.QUEST_STATE_INVALID)
                                {
                                    if ((TaskManager.Instance.NavigatingTaskType == GameConst.QUEST_NONE || TaskManager.Instance.NavigatingTaskType == tasksToGuide[0].Define.Type) &&
                                        (TaskHelper.TaskTypeInGuideCoroutine == GameConst.QUEST_NONE || TaskHelper.TaskTypeInGuideCoroutine == tasksToGuide[0].Define.Type))
                                    {
                                        // 如果需要自动寻路的任务是第三级别的自动执行,则需要先停止其他的任务寻路
                                        if (tasksToGuide[0].Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun2)
                                        {
                                            TargetPathManager.Instance.StopPlayerAndReset();
                                        }
                                        TaskHelper.TaskGuide(tasksToGuide[0]);
                                    }
                                }
                            }
                        }
                    }
                }

                if (newTasks.Count > 0)
                {
                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_ADDED, new CEventBaseArgs(newTasks[0].Define.Id));
                }

                TaskNet.HaveReceivedTaskInfo = true;

                break;
            }

            case NetMsg.MSG_TASK_DELETE:
            {
                S2CTaskDelete pack = S2CPackBase.DeserializePack <S2CTaskDelete>(data);

                Task navigatingTask = TaskManager.Instance.NavigatingTask;
                if (navigatingTask != null && navigatingTask.Define.Id == pack.id)
                {
                    TaskManager.Instance.NavigatingTask = null;
                    TargetPathManager.Instance.StopPlayerAndReset(false);
                }

                TaskManager.Instance.DeleteTask(pack.id);

                //ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_CHANGED, null);
                StartTaskChangedCoroutine();

                break;
            }

            case NetMsg.MSG_TASK_VALUE:
            {
                S2CTaskValue pack = S2CPackBase.DeserializePack <S2CTaskValue>(data);

                // 其它所有任务的置顶取消
                foreach (Task tempTask in TaskManager.Instance.AllTasks)
                {
                    if (tempTask.Define.Id != pack.id)
                    {
                        tempTask.IsOnTop = false;
                    }
                }

                bool isDone = false;
                uint value  = 0;
                if (pack.value.Count > 0)
                {
                    isDone = TaskManager.Instance.ChangeTaskCurStepValue(pack.id, pack.value[0]);
                    value  = pack.value[0];
                }
                else
                {
                    isDone = TaskManager.Instance.ChangeTaskCurStepValue(pack.id, 0);
                }

                Task task = TaskManager.Instance.GetTask(pack.id);

                // 提高任务显示优先级,头衔任务不受动态排序规则影响
                if (task != null && task.Define.Type != GameConst.QUEST_TITLE)
                {
                    Task.IncreaseCurDynamicShowPriority();
                    task.DynamicShowPriority = Task.CurDynamicShowPriority;
                }

                //TaskManager.Instance.SortTaskList();

                if (SceneHelp.Instance.IsInNormalWild() == true)
                {
                    if ((isDone == true || InstanceManager.Instance.IsAutoFighting == false) && task != null && task.Define.AutoRunType != TaskDefine.EAutoRunType.None)
                    {
                        if ((task.Define.AutoRunType == TaskDefine.EAutoRunType.AutoRun && InstanceManager.Instance.IsOnHook == false) || task.Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun || task.Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun2)
                        {
                            // 正在主线任务导航的时候,则不能自动执行其他类型的任务
                            if ((TaskManager.Instance.IsNavigatingMainTask == false && TaskHelper.MainTaskIsInGuideCoroutine == false) || task.Define.Type == GameConst.QUEST_MAIN)
                            {
                                // 进度大于0才自动执行
                                if (value > 0)
                                {
                                    if ((TaskManager.Instance.NavigatingTaskType == GameConst.QUEST_NONE || TaskManager.Instance.NavigatingTaskType == task.Define.Type) &&
                                        (TaskHelper.TaskTypeInGuideCoroutine == GameConst.QUEST_NONE || TaskHelper.TaskTypeInGuideCoroutine == task.Define.Type))
                                    {
                                        TaskHelper.TaskGuide(task);
                                    }
                                }
                            }
                        }
                    }
                }

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_PROGRESS_CHANGED, new CEventBaseArgs(pack.id));

                break;
            }

            case NetMsg.MSG_TASK_SG_INFO:
            {
                S2CTaskSgInfo pack = S2CPackBase.DeserializePack <S2CTaskSgInfo>(data);

                TaskManager.Instance.BountyTaskInfo = new BountyTaskInfo(pack.id, pack.num, pack.is_reward);
                if (TaskManager.Instance.BountyTaskInfo.id > 0 || TaskManager.Instance.BountyTaskInfo.is_reward == 0)
                {
                    TaskManager.Instance.BountyTaskCoinReward = 0;
                }

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.BOUNTY_TASK_CHANGED, null);

                if (IsFirstReceiveBountyTaskInfo == false)
                {
                    if (TaskManager.Instance.BountyTaskInfo.num >= TaskHelper.GetBountyTaskMaxTimes() && TaskManager.Instance.BountyTaskInfo.is_reward == 0)
                    {
                        if (SceneHelp.Instance.IsInWildInstance() == true)
                        {
                            xc.ui.ugui.UIManager.Instance.ShowSysWindow("UITaskWindow", xc.GameConst.QUEST_SG, null);
                        }
                        else
                        {
                            ClientEventMgr.GetInstance().PostEvent((int)ClientEvent.OPEN_TASK_WINDOW, new CEventBaseArgs(xc.GameConst.QUEST_SG));
                        }
                    }
                }

                IsFirstReceiveBountyTaskInfo = false;

                xc.ui.ugui.UIManager.Instance.ShowWaitScreen(false);

                break;
            }

            case NetMsg.MSG_TASK_REWARD_SG:
            {
                S2CTaskRewardSg pack = S2CPackBase.DeserializePack <S2CTaskRewardSg>(data);

                TaskManager.Instance.BountyTaskCoinReward = pack.coin;

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.BOUNTY_TASK_CHANGED, null);

                break;
            }

            case NetMsg.MSG_TASK_GUILD_INFO:
            {
                S2CTaskGuildInfo pack = S2CPackBase.DeserializePack <S2CTaskGuildInfo>(data);

                TaskManager.Instance.GuildTaskInfo = new GuildTaskInfo(pack.id, pack.num, pack.reward_state);
                //if (TaskManager.Instance.GuildTaskInfo.id > 0 || TaskManager.Instance.GuildTaskInfo.reward_state == 1)
                //{
                //    TaskManager.Instance.GuildTaskCtbReward = 0;
                //}

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.GUILD_TASK_CHANGED, null);

                if (IsFirstReceiveGuildTaskInfo == false && TaskManager.Instance.GuildTaskInfo.reward_state == 1)
                {
                    if (TaskManager.Instance.GuildTaskInfo.num >= GameConstHelper.GetInt("GAME_QUEST_GUILD_PRE_NUM"))
                    {
                        if (SceneHelp.Instance.IsInWildInstance() == true)
                        {
                            xc.ui.ugui.UIManager.Instance.ShowSysWindow("UITaskWindow", xc.GameConst.QUEST_GUILD, null);
                        }
                        else
                        {
                            ClientEventMgr.GetInstance().PostEvent((int)ClientEvent.OPEN_TASK_WINDOW, new CEventBaseArgs(xc.GameConst.QUEST_GUILD));
                        }
                    }
                }

                IsFirstReceiveGuildTaskInfo = false;

                xc.ui.ugui.UIManager.Instance.ShowWaitScreen(false);

                break;
            }

            case NetMsg.MSG_TASK_REWARD_GUILD:
            {
                S2CTaskRewardGuild pack = S2CPackBase.DeserializePack <S2CTaskRewardGuild>(data);

                TaskManager.Instance.GuildTaskCtbReward = pack.ctb;

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.GUILD_TASK_CHANGED, null);

                //UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("BAG_GET_GUILD_CTB"), pack.ctb));

                break;
            }

            case NetMsg.MSG_TASK_TRANSFER_INFO:
            {
                S2CTaskTransferInfo pack = S2CPackBase.DeserializePack <S2CTaskTransferInfo>(data);

                TaskManager.Instance.TransferTaskInfo = pack;

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.TRANSFER_TASK_CHANGED, null);

                break;
            }

            case NetMsg.MSG_TASK_REWARD_TRANSFER:
            {
                //暂时没有用到
                break;
            }

            default: break;
            }
        }
Пример #9
0
 public InstanceDropManager()
 {
     mMaxDropNum = GameConstHelper.GetInt("GAME_DROP_MAX_NUM");
 }
Пример #10
0
        public void AddFriend(FriendType type, FriendsInfo friend, bool isInit)
        {
            List <FriendsInfo> friendList = null;

            if (mCommon.TryGetValue(type, out friendList))
            {
                var info = friendList.Find(delegate(FriendsInfo _info)
                {
                    return(_info.Uid == friend.Uid);
                });
                if (info != null)
                {
                    if (type != FriendType.Enemy)
                    {
                        info.IsFirst = false;
                    }
                    else
                    {
                        foreach (var v in friendList)
                        {
                            if (v.Uid == info.Uid)
                            {
                                v.IsFirst = true;
                            }
                            else
                            {
                                v.IsFirst = false;
                            }
                        }
                    }
                    info.Copy(friend);
                }
                else
                {
                    if (type != FriendType.Enemy)
                    {
                        friendList.Add(friend);
                    }
                    else
                    {
                        int enemyInt = GameConstHelper.GetInt("GAME_ENEMY_NUM_LIMIT");
                        if (friendList.Count == enemyInt)
                        {
                            friendList.RemoveAt(friendList.Count - 1);
                        }
                        if (!isInit)
                        {
                            foreach (var v in friendList)
                            {
                                v.IsFirst = false;
                            }
                            friend.IsFirst = true;
                        }
                        friendList.Insert(0, friend);
                    }
                }
            }
            else
            {
                friendList = new List <FriendsInfo>();
                friendList.Add(friend);
                mCommon.Add(type, friendList);
            }
        }