コード例 #1
0
        public void ProcessLineCD(uint time)
        {
            SceneHelp.Instance.mChangeLineCDTime = time;
            mDelyLineCdTime = 0;
            ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_CHANGE_LINE_CD_TIME, new CEventBaseArgs());
            uint cd = 0;

            cd = GameConstHelper.GetUint("GAME_LINE_CHANGE_CD");
            if (SceneHelp.Instance.mChangeLineCDTime + cd > Game.GetInstance().ServerTime)
            {
                mDelyLineCdTime = SceneHelp.Instance.mChangeLineCDTime + cd - Game.GetInstance().ServerTime;
                mLineCDTimer    = new Utils.Timer((int)mDelyLineCdTime * 1000, false, 1000,
                                                  (dt) =>
                {
                    if (dt <= 0f)
                    {
                        mDelyLineCdTime = 0;
                        ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_CHANGE_LINE_CD_TIME, new CEventBaseArgs());
                        if (mLineCDTimer != null)
                        {
                            mLineCDTimer.Destroy();
                            mLineCDTimer = null;
                        }
                    }
                    else
                    {
                        mDelyLineCdTime = Mathf.Ceil(dt / 1000f);
                    }
                });
            }
        }
コード例 #2
0
        /// <summary>
        /// 处理服务端发送过来的分线信息
        /// </summary>
        /// <param name="msg"></param>
        public void ProcessLineInfo(S2CMapLineState msg)
        {
            mLineInfos.Clear();
            uint minLine = GameConstHelper.GetUint("GAME_LINE_MIN");

            for (int i = 1; i <= minLine; i++)
            {
                mLineInfos.Add((uint)i, 0);
            }

            // 设置每条分线上的人数
            foreach (var info in msg.hcounts)
            {
                uint count = 0;
                if (mLineInfos.TryGetValue(info.line, out count))
                {
                    mLineInfos[info.line] = info.count;
                }
                else
                {
                    mLineInfos.Add(info.line, info.count);
                }
            }

            ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_LINE_INFO, new CEventBaseArgs(msg.dungeon_id));
        }
コード例 #3
0
        /// <summary>
        /// 是否要播放开场剧情动画
        /// </summary>
        /// <returns></returns>
        public bool ShouldPlayOpenningTimeline()
        {
            // 如果配置为0则不用播放
            if (xc.GameConstHelper.GetUint("GAME_OPENING_TIMELINE_ID") == 0)
            {
                return(false);
            }

            if (SceneHelp.Instance.CurSceneID == GameConstHelper.GetUint("GAME_BORN_DUNGEON"))
            {
                uint localPlayerLevel = 0;
                uint.TryParse(GlobalConfig.GetInstance().LoginInfo.Level, out localPlayerLevel);
                //GameDebug.LogError("ShouldPlayOpenningTimeline localPlayerLevel: " + localPlayerLevel);
                if (localPlayerLevel <= 1)
                {
                    string uuid = GlobalConfig.GetInstance().LoginInfo.RId;
                    string key  = "HavePlayOpeningTimeline_" + uuid;
                    if (GlobalConfig.GetInstance().LoginInfo != null && GlobalConfig.GetInstance().LoginInfo.ServerInfo != null)
                    {
                        key = key + "_" + GlobalConfig.GetInstance().LoginInfo.ServerInfo.ServerId;
                    }
                    //GameDebug.LogError("ShouldPlayOpenningTimeline key: " + key);
                    int havePlayOpeningTimeline = xc.UserPlayerPrefs.GetInstance().GetInt(key, 0);
                    //GameDebug.LogError("ShouldPlayOpenningTimeline havePlayOpeningTimeline: " + havePlayOpeningTimeline);
                    if (havePlayOpeningTimeline == 0)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #4
0
ファイル: ChargeManager.cs プロジェクト: wuhuolong/MaxBooks
        /// <summary>
        /// 获取宝箱限购的状态
        /// </summary>
        /// <returns></returns>
        public uint GetLimitState()
        {
            //可购买0,可领取1,已领取2
            System.DateTime cur_date_time = Game.Instance.GetServerDateTime();

            //test
            //cur_date_time = DateHelper.GetDateTime(DebugCommand.serverTime);

            long cur_time_stamp = DateHelper.GetTimestamp(cur_date_time);

            System.DateTime buy_date_time  = DateHelper.GetDateTime((int)mBuyTime);
            long            buy_time_stamp = DateHelper.GetTimestamp(new System.DateTime(buy_date_time.Year, buy_date_time.Month, buy_date_time.Day, 0, 0, 0));

            System.DateTime got_date_time  = DateHelper.GetDateTime((int)mGotTime);
            long            got_time_stamp = DateHelper.GetTimestamp(new System.DateTime(got_date_time.Year, got_date_time.Month, got_date_time.Day, 0, 0, 0));

            if (cur_time_stamp - buy_time_stamp > GameConstHelper.GetUint("GAME_BIND_GOLD_BOX_DAYS") * 24 * 60 * 60)
            {
                //当前时间比上次购买的时间超过 7 天 为可以购买
                return(0);
            }
            else
            {
                if (cur_time_stamp - got_time_stamp > 24 * 60 * 60)
                {
                    //当前时间比上次领取的时间超过 1 天 为可以可领取
                    return(1);
                }
                else
                {
                    //当前时间比上次领取的时间小于 1 天 为已领取
                    return(2);
                }
            }
        }
コード例 #5
0
ファイル: MarryManager.cs プロジェクト: wuhuolong/MaxBooks
        public void Reset()
        {
            WeddingInstanceFoodsCount     = 0;
            mWeddingInstanceMaxFoodsCount = GameConstHelper.GetUint("GAME_DUNGEON_WEDDING_PERSON_MAX_FOODS");

            WeddingInstanceBoxCount     = 0;
            mWeddingInstanceMaxBoxCount = GameConstHelper.GetUint("GAME_DUNGEON_WEDDING_PERSON_MAX_BOX");
        }
コード例 #6
0
        public void LocalPlayerWalkToDestination(Vector3 targetPos, Task relateTask = null)
        {
            Actor player = Game.GetInstance().GetLocalPlayer();

            if (player == null)
            {
                return;
            }

            targetPos.y = RoleHelp.GetHeightInScene(player.ActorId, targetPos.x, targetPos.z);
            targetPos   = InstanceHelper.ClampInWalkableRange(targetPos, 10);

            // 判断是否可到达
            XNavMeshPath walkMeshPath = new XNavMeshPath();

            XNavMesh.CalculatePath(player.transform.position, targetPos, xc.Dungeon.LevelManager.GetInstance().AreaExclude, walkMeshPath);
            if (walkMeshPath.status != XNavMeshPathStatus.PathComplete)
            {
                // 如果通过任务导航寻路,且在新手副本的不可到达区域,则直接飞过去,以免因为配置错误而导致卡死
                if (relateTask != null && SceneHelp.Instance.CurSceneID == GameConstHelper.GetUint("GAME_BORN_DUNGEON"))
                {
                    GameDebug.LogWarning(DBConstText.GetText("MAP_POS_CAN_NOT_REACH") + ",该场景是新手场景,直接瞬移过去");
                    player.MoveCtrl.SendFly(targetPos);
                    player.SetPosition(targetPos);
                }
                else
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("MAP_POS_CAN_NOT_REACH"));
                }
                return;
            }

            InstanceManager.Instance.IsAutoFighting = false;

            mPathWalker.WalkTo(targetPos);
            //player.MoveCtrl.TryWalkTo(targetPos);

            /*
             * uint instanceType = InstanceManager.Instance.InstanceType;
             *
             * if (instanceType == GameConst.WAR_TYPE_WILD || instanceType == GameConst.WAR_TYPE_HOLE || instanceType == GameConst.WAR_SUBTYPE_WILD_PUB || instanceType == GameConst.WAR_TYPE_MULTI)
             * {
             *  if(mPathWalker == null)
             *  {
             *      return;
             *  }
             *
             *  mPathWalker.WalkTo(targetPos);
             * }
             * else
             * {
             *  player.MoveCtrl.TryWalkTo(targetPos);
             * }*/

            TaskNavigationActive(true);
            IsNavigating = true;
        }
コード例 #7
0
ファイル: QualitySetting.cs プロジェクト: wuhuolong/MaxBooks
        public QualitySetting()
        {
            MaxPlayerLow  = GameConstHelper.GetUint("GAME_MAX_PLAYER_LOW");
            MaxPlayerMid  = GameConstHelper.GetUint("GAME_MAX_PLAYER_MID");
            MaxPlayerHigh = GameConstHelper.GetUint("GAME_MAX_PLAYER_HIGH");

            // 同屏处理玩家的最大数量
            MaxPlayerProcessLow  = GameConstHelper.GetUint("GAME_MAX_PLAYER_PROCESS_LOW");
            MaxPlayerProcessMid  = GameConstHelper.GetUint("GAME_MAX_PLAYER_PROCESS_MID");
            MaxPlayerProcessHigh = GameConstHelper.GetUint("GAME_MAX_PLAYER_PROCESS_HIGH");
        }
コード例 #8
0
        /// <summary>
        /// 添加好友申请
        /// </summary>
        /// <param name="friendsInfo"></param>
        public void AddApplicant(FriendsInfo friendsInfo)
        {
            if (Applicants.Find(Applicant => Applicant.Uid == friendsInfo.Uid) == null)
            {
                Applicants.Insert(0, friendsInfo);
            }
            uint limit = GameConstHelper.GetUint("GAME_FRIEND_APPLICATION_LIMIT");

            if (Applicants.Count > limit)
            {
                Applicants.RemoveAt(Applicants.Count - 1);
            }
        }
コード例 #9
0
ファイル: TransferHelper.cs プロジェクト: wuhuolong/MaxBooks
        /// <summary>
        /// return 是否巅峰
        /// currentLevel    当前等级
        /// transferLevel   当前转职等级
        /// peakLevel会被赋值为巅峰等级,如果不是巅峰,peakLevel是当前等级
        /// </summary>
        public static bool IsPeak(uint currentLevel, out uint peakLevel, uint transferLevel = 999)
        {
            bool isAwaken = transferLevel == 999 || transferLevel >= GameConstHelper.GetUint("GAME_TRANSFER_PEAK_TRANS_LV_BASE");
            bool isPeak   = isAwaken && currentLevel > GameConstHelper.GetUint("GAME_TRANSFER_PEAK_LV_BASE");

            if (isPeak)
            {
                peakLevel = currentLevel - GameConstHelper.GetUint("GAME_TRANSFER_PEAK_LV_BASE");
            }
            else
            {
                peakLevel = currentLevel;
            }
            return(isPeak);
        }
コード例 #10
0
ファイル: TransferHelper.cs プロジェクト: wuhuolong/MaxBooks
        /// <summary>
        /// 自己是否巅峰
        /// peakLevel会被赋值为巅峰等级,如果不是巅峰,peakLevel是当前等级
        /// </summary>
        public static bool IsSelfPeak(out uint peakLevel)
        {
            bool isAwaken     = GetTransferLevel() >= GameConstHelper.GetUint("GAME_TRANSFER_PEAK_TRANS_LV_BASE");
            uint currentLevel = LocalPlayerManager.Instance.Level;
            bool isPeak       = isAwaken && currentLevel > GameConstHelper.GetUint("GAME_TRANSFER_PEAK_LV_BASE");

            if (isPeak)
            {
                peakLevel = currentLevel - GameConstHelper.GetUint("GAME_TRANSFER_PEAK_LV_BASE");
            }
            else
            {
                peakLevel = currentLevel;
            }
            return(isPeak);
        }
コード例 #11
0
        /// <summary>
        /// 获取对应的组队目标队伍人数上限
        /// </summary>
        /// <returns></returns>
        public static uint GetTeamTargetMemberLimit()
        {
            uint          targetId = TeamManager.Instance.TargetId;
            List <string> strs     = DBManager.Instance.QuerySqliteField <string>(GlobalConfig.DBFile, "data_team_target", "id", targetId.ToString(), "member_limit");

            if (strs.Count > 0)
            {
                uint memberLimit = 0;
                if (uint.TryParse(strs[0], out memberLimit) == true)
                {
                    return(memberLimit);
                }
            }

            return(GameConstHelper.GetUint("GAME_TEAM_MEMBER_LIMIT"));
        }
コード例 #12
0
ファイル: CustomDataMgr.cs プロジェクト: wuhuolong/MaxBooks
        public List <int> GetCustomData(CustomDataType type)
        {
            List <int> ret = null;

            if (!m_data.TryGetValue((uint)type, out ret))
            {
                ret = new List <int>();
            }

            //WorldMapLock, 出生地图默认已经解锁
            if (type == CustomDataType.WorldMapLock && 0 == ret.Count)
            {
                uint id = GameConstHelper.GetUint("GAME_DEFAULT_UNLOCK_DUNGEON");
                ret.Add((int)id);
            }

            return(ret);
        }
コード例 #13
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");
 }
コード例 #14
0
ファイル: ReconnectState.cs プロジェクト: wuhuolong/MaxBooks
        /// <summary>
        /// Reconnect
        /// </summary>
        /// <param name="s"></param>
        public void EnterState_Reconnect(xc.Machine.State s)
        {
            m_DisconnectEnterReason = m_DisconnectReason;
            GameDebug.LogRed("disconnect reason: " + m_DisconnectEnterReason);
            GameDebug.Log("EnterState_Reconnect");
            m_RetryTime     = 0;
            m_RetryNextTime = 0;
            m_RetryCount    = 0;
            m_IsReconnect   = true;
            m_IsSendRecon   = false;
            uint time_out = GameConstHelper.GetUint("GAME_OFFLINE_TIMEOUT");

            if (time_out != 0)
            {
                m_OfflineTimeout = time_out;
            }
            UIManager.Instance.ShowWindow("UIAutoConnectWindow");
        }
コード例 #15
0
ファイル: ChargeManager.cs プロジェクト: wuhuolong/MaxBooks
        /// <summary>
        /// 获取限购剩余的天数
        /// </summary>
        /// <returns></returns>
        public long GetLimiteLastDay()
        {
            long day = 0;

            System.DateTime cur_date_time = Game.Instance.GetServerDateTime();

            //test
            //cur_date_time = DateHelper.GetDateTime(DebugCommand.serverTime);

            long cur_time_stamp = DateHelper.GetTimestamp(cur_date_time);

            System.DateTime buy_date_time    = DateHelper.GetDateTime((int)mBuyTime);
            long            buy_time_stamp   = DateHelper.GetTimestamp(new System.DateTime(buy_date_time.Year, buy_date_time.Month, buy_date_time.Day, 0, 0, 0));
            long            close_time_stamp = buy_time_stamp + GameConstHelper.GetUint("GAME_BIND_GOLD_BOX_DAYS") * 24 * 60 * 60;

            //结束时间距离当前时间 / (24 * 60 * 60)
            day = (close_time_stamp - cur_time_stamp) / (24 * 60 * 60);
            return(day);
        }
コード例 #16
0
ファイル: FriendsNet.cs プロジェクト: wuhuolong/MaxBooks
        /// <summary>
        /// 发送申请好友请求
        /// </summary>
        /// <param name="id"></param>
        public void SendAddFriendRequest(FriendType type, uint id, uint targetLv = 0)
        {
            if (targetLv > 0)
            {
                uint limit = GameConstHelper.GetUint("GAME_FRIEND_LV_LIMIT");
                if (targetLv < limit)
                {
                    UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("FRIENDS_ADD_OTHER_LEVEL_NOT_ENOUGH"), limit));
                    return;
                }
            }
            var data = new C2SRelationAdd();

            data.type      = (uint)type;
            data.target_id = id;
            NetClient.GetBaseClient().SendData <C2SRelationAdd>(NetMsg.MSG_RELATION_ADD, data);
            //if (type == FriendType.Friend)
            //    UINotice.Instance.ShowMessage(DBConstText.GetText("HAS_SENT_FRIEND_APPLICATION"));
        }
コード例 #17
0
ファイル: TransferHelper.cs プロジェクト: wuhuolong/MaxBooks
        /// <summary>
        /// 自己是否巅峰
        /// </summary>
        public static bool IsSelfPeak()
        {
            bool isAwaken = GetTransferLevel() >= GameConstHelper.GetUint("GAME_TRANSFER_PEAK_TRANS_LV_BASE");

            return(isAwaken && LocalPlayerManager.Instance.Level > GameConstHelper.GetUint("GAME_TRANSFER_PEAK_LV_BASE"));
        }
コード例 #18
0
        public void Reset()
        {
            foreach (Dictionary <string, string> row in DBManager.Instance.QuerySqliteTable <string>(GlobalConfig.DBFile, "data_persional_default"))
            {
                uint id = 0;
                uint.TryParse(row["id"], out id);
                uint defaultValue = 0;
                uint.TryParse(row["default"], out defaultValue);
                switch (id)
                {
                case GameConst.SETTING_KEY_HOOK_USE_HP_DRUG_HP_RATIO:
                {
                    mUseHPDrugHPRatio = ((float)defaultValue) / 100f;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_USE_MP_DRUG_MP_RATIO:
                {
                    mUseMPDrugMPRatio = ((float)defaultValue) / 100f;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_RANGE_TYPE:
                {
                    mRangeType = (EHookRangeType)defaultValue;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_BUY_DRUG:
                {
                    mAutoBuyDrug = (defaultValue > 0) ? true : false;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_SWALLOW:
                {
                    mAutoSwallow = (defaultValue > 0) ? true : false;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_REVIVE:
                {
                    mAutoRevive = (defaultValue > 0) ? true : false;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_SELL_GOODS:
                {
                    mAutoSellGoods = (defaultValue > 0) ? true : false;
                    break;
                }

                case GameConst.SETTING_KEY_HOOK_AUTO_PICK_DROP_PREFIX:
                {
                    mAutoPickDrop = (defaultValue > 0) ? true : false;
                    break;
                }

                default:
                    break;
                }
            }

            mAutoBuyHPDrugGoodsId   = 0;
            mAutoBuyHPDrugMoneyType = 0;
            mAutoBuyHPDrugPrice     = 0;
            mAutoBuyMPDrugGoodsId   = 0;
            mAutoBuyMPDrugMoneyType = 0;
            mAutoBuyMPDrugPrice     = 0;

            mIsBuyingDrug   = false;
            mIsSellingGoods = false;
            mIsUsingHPDrug  = false;
            mIsUsingMPDrug  = false;

            if (mTimer != null)
            {
                mTimer.Destroy();
                mTimer = null;
            }
            mTimer = new Utils.Timer(5000, true, Mathf.Infinity, UpdateTimer);

            mUseHPDrugGoodsIds = GameConstHelper.GetUintList("GAME_HOOK_USE_HP_DRUG_GOODS_ID");
            mUseMPDrugGoodsIds = GameConstHelper.GetUintList("GAME_HOOK_USE_MP_DRUG_GOODS_ID");
            mAutoBuyHPDrugNum  = GameConstHelper.GetUint("GAME_HOOK_BUY_HP_DRUG_NUM");
            mAutoBuyMPDrugNum  = GameConstHelper.GetUint("GAME_HOOK_BUY_MP_DRUG_NUM");
        }
コード例 #19
0
ファイル: TaskNet.cs プロジェクト: wuhuolong/MaxBooks
        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;
            }
        }
コード例 #20
0
ファイル: Game.cs プロジェクト: wuhuolong/MaxBooks
        /// <summary>
        /// 加载场景完成的检查
        /// </summary>
        void SceneLoadingUpdate()
        {
            // 场景的Scene文件加载完毕
            if (mLoadASyncOp != null && mLoadASyncOp.isDone)
            {
                // 通过IsSwitchingScene变量确保场景初始化的逻辑只执行一次
                if (SceneHelp.Instance.IsSwitchingScene)
                {
                    QualitySetting.SetSceneGL((EGraphLevel)QualitySetting.GraphicLevel);

                    // 设置相机layer裁剪距离
                    Camera cur_camera = Game.Instance.MainCamera;
                    if (cur_camera != null)
                    {
                        // 尝试从CameraCull组件中获取裁剪的距离
                        float cull_distance = 18;
                        var   camera_cull   = cur_camera.GetComponent <CameraCull>();
                        if (camera_cull != null)
                        {
                            cull_distance = camera_cull.CullDistance;
                        }

                        for (int i = 0; i < 32; ++i)
                        {
                            distances[i] = 0;
                        }

                        distances[23] = cull_distance; // Tree
                        distances[26] = cull_distance; // SplitScene

                        cur_camera.layerCullDistances = distances;
                        cur_camera.layerCullSpherical = false;

                        int invisible_mask = (1 << LayerMask.NameToLayer("UI")) | (1 << LayerMask.NameToLayer("UI2")) | (1 << LayerMask.NameToLayer("Hide"));
                        cur_camera.cullingMask = ~invisible_mask & cur_camera.cullingMask;
                        //cur_camera.gameObject.AddComponent<CameraScale>();
                    }

                    SceneHelp.Instance.IsSwitchingScene       = false;
                    SceneHelp.Instance.IsLoadingQuadTreeScene = SceneHelp.LoadQuadTreeSceneState.Loading;
                    // 目前不自动隐藏loading界面的场景都未进行切割(登录\创角\选角)
                    if (SceneHelp.Instance.AutoHideLoadingUI)
                    {
                        QuadTreeSceneManager.Instance.StartLoadListener();
                    }
                    else
                    {
                        Application.targetFrameRate = Const.G_FPS;// 恢复帧率限制
                    }
                    ScenePostProcess.Instance.Do();
                }

                // 处理自动隐藏loading界面的逻辑
                if (SceneHelp.Instance.AutoHideLoadingUI)
                {
                    // 非野外和副本的时候,可以直接隐藏loading界面
                    if (SceneHelp.Instance.IsInWildInstance() || SceneHelp.Instance.IsInInstance)
                    {
                        if (MainCamera == null)
                        {
                            return;
                        }

                        var local_player = Game.Instance.GetLocalPlayer();
                        if (local_player != null)
                        {
                            // 本地玩家创建之后才设置SplitScene可见, 以防止加载额外的动态场景
                            if ((MainCamera.cullingMask & mSplitSceneLayer) == 0)
                            {
                                MainCamera.cullingMask = MainCamera.cullingMask | mSplitSceneLayer;
                            }

                            // 加载完毕后再隐藏loading界面
                            if (QuadTreeSceneManager.Instance.LoadFinish)
                            {
                                SceneHelp.Instance.IsLoadingQuadTreeScene = SceneHelp.LoadQuadTreeSceneState.LoadFinished;
                            }

                            if (SceneHelp.Instance.IsLoadingQuadTreeScene == SceneHelp.LoadQuadTreeSceneState.LoadFinished)
                            {
                                if (UIManager.Instance.LoadingBKIsShow == true)
                                {
                                    // 新手剧情prefab加载完毕后再隐藏loading界面
                                    if (SceneHelp.Instance.CurSceneID == GameConstHelper.GetUint("GAME_BORN_DUNGEON") && TimelineManager.Instance.ShouldPlayOpenningTimeline() == true)
                                    {
                                        if (TimelineManager.Instance.OpenningTimelineHavePlayed() == true && TimelineManager.Instance.IsLoading() == false && TimelineManager.Instance.IsPreloading() == false)
                                        {
                                            if (UIManager.Instance.LoadingBKIsShow == true)
                                            {
                                                UIManager.Instance.ShowLoadingBK(false);
                                                ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_FINISH_LOAD_SCENE, null);
                                            }
                                        }
                                    }
                                    else  // 没有新手剧情,直接隐藏loading界面
                                    {
                                        UIManager.Instance.ShowLoadingBK(false);
                                        ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_FINISH_LOAD_SCENE, null);
                                    }
                                }
                            }
                        }
                        else
                        {
                            // 没有localplayer的时候,SplitScene设置为不可见
                            if ((MainCamera.cullingMask & mSplitSceneLayer) != 0)
                            {
                                MainCamera.cullingMask = MainCamera.cullingMask & ~mSplitSceneLayer;
                            }
                        }
                    }
                    else
                    {
                        UIManager.Instance.ShowLoadingBK(false);
                    }
                }
            }
        }
コード例 #21
0
        void OnModelChange(CEventBaseArgs param)
        {
            WorshipModel owner = mOwner as WorshipModel;

            if (owner == null)
            {
                return;
            }

            // 头顶名字
            if (mTextComponent != null)
            {
                UnityEngine.Object.DestroyImmediate(mTextComponent);
            }
            mTextComponent = mOwner.GetModelParent().AddComponent <UI3DText>();
            UI3DText.StyleInfo styleInfo = new UI3DText.StyleInfo();
            float modelScale             = GameConstHelper.GetFloat("GAME_DUNGEON_WORSHIP_MODEL_SCALE");

            styleInfo.HeadOffset   = new Vector3(0f, mOwner.Height * modelScale, 0f);
            styleInfo.ScreenOffset = UI3DText.NameTextScreenOffset * modelScale;
            mTextComponent.SetHeadTrans(mOwner.GetModelParent().transform);
            mTextComponent.ResetStyleInfo(styleInfo);
            string text = "<color=#ffc319>" + owner.Rank.ToString();

            if (owner.Rank == 1)
            {
                text = text + DBConstText.GetText("ANSWER_WORSHIP_1"); // "st雕像";
            }
            else if (owner.Rank == 2)
            {
                text = text + DBConstText.GetText("ANSWER_WORSHIP_2");  //"nd雕像";
            }
            else if (owner.Rank == 3)
            {
                text = text + DBConstText.GetText("ANSWER_WORSHIP_3");  //"rd雕像";
            }
            else
            {
                text = text + DBConstText.GetText("ANSWER_WORSHIP_4");  //"th雕像";
            }
            text = text + "</color>";
            mTextComponent.RankTextLabel = text;
            mTextComponent.FontSize      = 22;
            if (string.IsNullOrEmpty(owner.GuildName) == false)
            {
                mTextComponent.GuildNameTextLabel = "<color=#4ef269><" + owner.GuildName + "></color>";
            }
            mTextComponent.Text = "<color=#5ec4ff>" + owner.UserName + "</color>";

            // 膜拜按钮
            if (mWorshipButtonComponent != null)
            {
                UnityEngine.Object.DestroyImmediate(mWorshipButtonComponent);
            }
            mWorshipButtonComponent = mOwner.GetModelParent().AddComponent <UI3DText>();
            styleInfo              = new UI3DText.StyleInfo();
            modelScale             = GameConstHelper.GetFloat("GAME_DUNGEON_WORSHIP_MODEL_SCALE");
            styleInfo.HeadOffset   = Vector3.zero;
            styleInfo.ScreenOffset = Vector3.zero;
            mWorshipButtonComponent.SetHeadTrans(ModelHelper.FindChildInHierarchy(mOwner.GetModelParent().transform, "root_node"));
            mWorshipButtonComponent.ResetStyleInfo(styleInfo);
            mWorshipButtonComponent.SetButtonStyle("MainWindow_New@Chatting@Praisebtn", DBConstText.GetText("WORSHIP"), 24, new Color(0.2f, 0.2f, 0.2f), new Vector3(0f, -9f, 0f));
            UnityEngine.UI.Image buttonImage = mWorshipButtonComponent.ButtonImage;
            if (buttonImage != null)
            {
                buttonImage.sprite = mWorshipButtonComponent.LoadSprite("MainWindow_New@Chatting@Hands");
                buttonImage.SetNativeSize();
                buttonImage.transform.localPosition = new Vector3(75, 40, 0);
                xc.ui.ugui.TweenPosition tween = xc.ui.ugui.TweenPosition.Begin(buttonImage.gameObject, 0.8f, new Vector3(100, 55, 0));
                tween.style = ui.ugui.UITweener.Style.PingPong;
                buttonImage.gameObject.SetActive(false);
            }
            mWorshipButtonComponent.SetClickCallback(() =>
            {
                mWorshipButtonComponent.ShowButton(false);
                if (buttonImage != null)
                {
                    buttonImage.gameObject.SetActive(false);
                }

                var data  = new C2SPlayerWorship();
                data.rank = owner.Rank;
                NetClient.GetBaseClient().SendData <C2SPlayerWorship>(NetMsg.MSG_PLAYER_WORSHIP, data);

                Actor localPlayer = Game.Instance.GetLocalPlayer();
                if (localPlayer != null)
                {
                    localPlayer.AttackCtrl.Attack(GameConstHelper.GetUint("GAME_DUNGEON_WORSHIP_SKILL_ID"));
                }
            });
            mWorshipButtonComponent.ShowButton(false);

            mTextComponent.Honor = mOwner.Honor;
            mTextComponent.Title = mOwner.Title;
        }
コード例 #22
0
        public void JumpToScene(bool check, uint id, uint line = 0, Task relateTask = null)
        {
            // 在新手村第一次跳场景的时候,去找第一个传送点
            if (check == true && IsFirstNavigatingJumpToScene == true && SceneHelp.Instance.CurSceneID == GameConstHelper.GetUint("GAME_BORN_DUNGEON"))
            {
                Dictionary <int, Neptune.BaseGenericNode> colliders = Neptune.DataManager.Instance.Data.GetData <Neptune.Collider>().Data;
                if (colliders != null)
                {
                    foreach (Neptune.BaseGenericNode collider in colliders.Values)
                    {
                        if (collider.Id == 1)
                        {
                            if (InstanceHelper.CanWalkTo(collider.Position) == true)
                            {
                                LocalPlayerWalkToDestination(collider.Position, relateTask);
                                return;
                            }
                            break;
                        }
                    }
                }
            }

            SceneHelp.JumpToScene(id, line);
        }
コード例 #23
0
        /// <summary>
        /// 飞鞋
        /// </summary>
        public static bool TravelBootsJump(Vector3 pos, uint instanceId = 0, bool isFree = false, uint line = 1, bool isAutoFighting = false)
        {
            if (instanceId == 0)
            {
                instanceId = SceneHelp.Instance.CurSceneID;
            }

            if (PKModeManagerEx.Instance.TryToOtherDungeonScene() == false)
            {
                return(false);
            }

            DBInstance.InstanceInfo instanceInfo = DBInstance.Instance.GetInstanceInfo(instanceId);
            if (instanceInfo == null)
            {
                GameDebug.LogError("Travel boots ump to scene " + instanceId + " error, can not find instance info!!!");
                return(false);
            }

            // 本地玩家处于护送状态不能用飞鞋
            if (CheckLocalPlayerEscortTaskState() == false)
            {
                return(false);
            }

            // 检查道具
            if (isFree == false)
            {
                if (VipHelper.GetIsFlyFree() == false)
                {
                    uint need_goods = GameConstHelper.GetUint("GAME_ITEM_TRAVEL_BOOTS");
                    if (need_goods > 0)
                    {
                        var num = ItemManager.Instance.GetGoodsNumForBagByTypeId(need_goods);
                        if (num <= 0)
                        {
                            UINotice.Instance.ShowMessage(DBConstText.GetText("ITME_NUM_NOTENOUGH"));
                            return(false);
                        }
                    }
                }
            }

            bool isInstance = false;

            if (instanceInfo.mWarType == GameConst.WAR_TYPE_DUNGEON)
            {
                isInstance = true;
            }

            // 检查是否达到等级
            uint needLv = InstanceHelper.GetInstanceNeedRoleLevel(instanceId);

            if (LocalPlayerManager.Instance.LocalActorAttribute.Level < needLv)
            {
                // 巅峰等级
                uint   peakLv   = 0;
                bool   isPeak   = TransferHelper.IsPeak(needLv, out peakLv);
                string levelStr = "";
                if (isPeak)
                {
                    levelStr = string.Format(DBConstText.GetText("UI_PLAYER_PEAK_LEVEL_FORMAT_2"), peakLv); // 巅峰{0}
                }
                else
                {
                    levelStr = peakLv.ToString(); // {0}
                }
                if (isInstance == true)
                {
                    UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("INSTANCE_IS_NOT_UNLOCK_NEED_LEVEL"), levelStr));
                }
                else
                {
                    UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("WILD_INSTANCE_IS_NOT_UNLOCK_NEED_LEVEL"), levelStr));
                }
                return(false);
            }

            // 检查是否通关某主线任务
            uint needTaskId = instanceInfo.mNeedTaskId;

            if (needTaskId > 0)
            {
                if (TaskHelper.MainTaskIsPassed(needTaskId) == false)
                {
                    TaskDefine needTaskDefine = TaskDefine.MakeDefine(needTaskId);
                    if (needTaskDefine != null)
                    {
                        // 巅峰等级
                        uint   peakLv   = 0;
                        bool   isPeak   = TransferHelper.IsPeak((uint)needTaskDefine.RequestLevelMin, out peakLv);
                        string levelStr = "";
                        if (isPeak)
                        {
                            levelStr = string.Format(DBConstText.GetText("UI_PLAYER_PEAK_LEVEL_FORMAT_2"), peakLv); // 巅峰{0}
                        }
                        else
                        {
                            levelStr = peakLv.ToString(); // {0}
                        }
                        if (isInstance == true)
                        {
                            UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("INSTANCE_IS_NOT_UNLOCK_NEED_TASK"), levelStr, needTaskDefine.Name, instanceInfo.mName));
                        }
                        else
                        {
                            UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("WILD_INSTANCE_IS_NOT_UNLOCK_NEED_TASK"), levelStr, needTaskDefine.Name, instanceInfo.mName));
                        }
                    }
                    return(false);
                }
            }

            // 判断是否可到达
            if (instanceId == SceneHelp.Instance.CurSceneID)
            {
                if (InstanceHelper.CanWalkTo(pos) == false)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("MAP_POS_CAN_NOT_REACH"));
                    return(false);
                }
            }

            // 跳往不同的场景需要加个转圈,防止同时多次跳转
            if (instanceId != SceneHelp.Instance.CurSceneID)
            {
                ui.ugui.UIManager.GetInstance().ShowWaitScreen(true);
            }

            C2STravelBootsJump data = new C2STravelBootsJump();

            data.dungeon_id = instanceId;
            data.line       = line;
            PkgNwarPos pkgNwarPos = new PkgNwarPos();

            pkgNwarPos.px = (int)(pos.x / GlobalConst.UnitScale);
            pkgNwarPos.py = (int)(pos.z / GlobalConst.UnitScale);
            data.pos      = pkgNwarPos;
            if (isFree == true)
            {
                data.is_free = 1;
            }
            else
            {
                data.is_free = 0;
            }

            NetClient.BaseClient.SendData <C2STravelBootsJump>(NetMsg.MSG_TRAVEL_BOOTS_JUMP, data);

            SceneHelp.Instance.IsAutoFightingAfterSwitchInstance = isAutoFighting;

            InstanceManager.Instance.IsAutoFighting = false;

            return(true);
        }
コード例 #24
0
ファイル: TransferHelper.cs プロジェクト: wuhuolong/MaxBooks
        /// <summary>
        /// return  是否巅峰
        /// currentLevel    当前等级
        /// transferLevel   当前转职等级
        /// </summary>
        public static bool IsPeak(uint currentLevel, uint transferLevel = 999)
        {
            bool isAwaken = transferLevel == 999 || transferLevel >= GameConstHelper.GetUint("GAME_TRANSFER_PEAK_TRANS_LV_BASE");

            return(isAwaken && currentLevel > GameConstHelper.GetUint("GAME_TRANSFER_PEAK_LV_BASE"));
        }