Esempio n. 1
0
        /// <summary>
        /// 暂停自动战斗
        /// </summary>
        public void PauseAutoFighting(bool isShowTips = false)
        {
            if (InstanceHelper.InstanceIsInPlay() == false)
            {
                return;
            }

            Actor localPlayer = Game.GetInstance().GetLocalPlayer();

            if (localPlayer == null)
            {
                return;
            }

            if (IsAutoFighting && localPlayer.GetAIEnable() == true)
            {
                localPlayer.ActiveAI(false);
                localPlayer.AttackCtrl.ClearCacheSkill();
                GameInput.Instance.EnableInput(true);
                mAutoFightBreakingTime = 0.0f;
                mAutoBreakRecoverTime  = GameConstHelper.GetFloat("GAME_AUTO_FIGHT_BREAK_RECOVER_TIME");

                if (isShowTips == true)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("AUTO_FIGHT_PAUSE"));
                }
            }
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        /// <summary>
        /// 获取当前预览的物体,更新预览界面的角色灯光
        /// </summary>
        public void UpdatePreviewLight(GameObject preview_object)
        {
            var role_ids = GameConstHelper.GetUintList("GAME_AVAILABLE_ROLE_ID");
            var type_ids = new List <uint>(role_ids.Count);

            foreach (var rid in role_ids)
            {
                type_ids.Add(ActorHelper.RoleIdToTypeId(rid));
            }

            uint actor_type_id = 0;
            var  client_model  = preview_object.GetComponentInChildren <ActorMono>(true);

            if (client_model != null && client_model.BindActor != null)
            {
                actor_type_id = client_model.BindActor.TypeIdx;
            }

            if (type_ids.Contains(actor_type_id))
            {
                PreviewLight.SelectLight(0, ActorHelper.TypeIdToRoleId(actor_type_id));
            }
            else
            {
                PreviewLight.SelectLight(0, 0);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 重登之后需要重置
        /// </summary>
        public void Reset()
        {
            if (mDisplayTips.Count > 0)
            {
                foreach (var item in mDisplayTips)
                {
                    item.mLabel.text = string.Empty;
                }
            }
            else
            {
                mIsLoad = false;
                MainGame.HeartBehavior.StartCoroutine(InitLoad());
                mIsInit = true;
            }

            mCacheText.Clear();
            foreach (var item in mDisplayingTips)
            {
                item.gameObject.SetActive(false);
                item.transform.parent.gameObject.SetActive(false);
            }
            mDisplayingTips.Clear();
            mDisplayingTipTransforms.Clear();

            if (mTimer != null)
            {
                mTimer.Destroy();
                mTimer = null;
            }
            mTimer = new Utils.Timer((int)(GameConstHelper.GetFloat("GAME_FLOAT_TIPS_INTERVAL") * 1000f), true, Mathf.Infinity, UpdateTimer);

            ClientEventMgr.Instance.SubscribeClientEvent((int)ClientEvent.CE_SWITCHINSTANCE, OnSwitchInstance);
            ClientEventMgr.Instance.SubscribeClientEvent((int)ClientEvent.CE_SHOW_ROLLING_NOTICE_END, OnShowRollingNoticeEnd);
        }
Esempio n. 5
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);
                    }
                });
            }
        }
Esempio n. 6
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));
        }
Esempio n. 7
0
        /// <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);
                }
            }
        }
Esempio n. 8
0
        bool mIsBuyingDrug = false; // 是否正在买药,即发了买药的消息且服务端还没回复
        public void UpdateAutoBuyDrugGoodsId()
        {
            if (LocalPlayerManager.Instance.LocalActorAttribute != null)
            {
                uint level = LocalPlayerManager.Instance.LocalActorAttribute.Level;
                List <List <uint> > uintUintList = DBTextResource.ParseArrayUintUint(GameConstHelper.GetString("GAME_HOOK_BUY_HP_DRUG_GOODS_ID"));
                foreach (List <uint> uintList in uintUintList)
                {
                    if (level < uintList[0])
                    {
                        mAutoBuyHPDrugGoodsId = uintList[1];
                        break;
                    }
                }
                uintUintList = DBTextResource.ParseArrayUintUint(GameConstHelper.GetString("GAME_HOOK_BUY_MP_DRUG_GOODS_ID"));
                foreach (List <uint> uintList in uintUintList)
                {
                    if (level < uintList[0])
                    {
                        mAutoBuyMPDrugGoodsId = uintList[1];
                        break;
                    }
                }

                UpdateAutoBuyDrugGoodsPrice();
            }
        }
Esempio n. 9
0
 public override void Load()
 {
     if (mount_action_name_array == null)
     {
         mount_action_name_array = GameConstHelper.GetStringList("GAME_VOCATION_MOUNT_INFO_ROW_NAME");
     }
     base.Load();
 }
Esempio n. 10
0
        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");
        }
Esempio n. 11
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;
        }
Esempio n. 12
0
        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");
        }
Esempio n. 13
0
        void Init()
        {
            ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_TRIGGER_SKILL_CLICK_BUTTON, OnClick);
            ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_TRIGGER_SKILL_PRESS_BUTTON, OnPress);
            ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_TRIGGER_SKILL_RELEASE_BUTTON, OnRelease);

            m_skills_using_array = null;
            m_skills_info_array  = null;

            m_rockButtonTipsInterval = GameConstHelper.GetFloat("GAME_ROCK_BUTTON_TIPS_INTERVAL");
        }
Esempio n. 14
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);
            }
        }
Esempio n. 15
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);
        }
Esempio n. 16
0
        /// <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);
        }
Esempio n. 17
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);
        }
Esempio n. 18
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"));
        }
Esempio n. 19
0
        /// <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);
        }
Esempio n. 20
0
        protected override void InitAOIData(xc.UnitCacheInfo info)
        {
            base.InitAOIData(info);

            if (ActorManager.Instance.WorshipModelSet.ContainsKey(info.UnitID) == false)
            {
                ActorManager.Instance.WorshipModelSet.Add(info.UnitID, this);
            }
            else
            {
                GameDebug.LogError("WorshipModel has conflict key " + info.UnitID.obj_idx);
            }

            float touchRadius = GameConstHelper.GetFloat("GAME_DUNGEON_WORSHIP_MODEL_TOUCH_RADIUS");

            mTouchSqrRadius = touchRadius * touchRadius;
        }
Esempio n. 21
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");
 }
Esempio n. 22
0
        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);
        }
Esempio n. 23
0
        /// <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");
        }
Esempio n. 24
0
        /// <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);
        }
Esempio n. 25
0
        /// <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"));
        }
Esempio n. 26
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();
            }
        }
Esempio n. 27
0
        /// <summary>
        /// 任务更新事件协程,避免短时间内多次刷新任务,造成卡顿
        /// </summary>
        static void StartTaskChangedCoroutine()
        {
            if (mTaskChangedCoroutine != null)
            {
                mTaskChangedCoroutine.Stop();
                mTaskChangedCoroutine = null;
            }

            if (mTaskChangedCoroutineDelayTime < 0f)
            {
                mTaskChangedCoroutineDelayTime = GameConstHelper.GetFloat("GAME_TASK_CHANGED_EVENT_DELAY");
            }

            // 如果配置成0,则立刻刷新
            if (mTaskChangedCoroutineDelayTime == 0f)
            {
                ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_CHANGED, null);
            }
            else
            {
                mTaskChangedCoroutine = SafeCoroutine.CoroutineManager.StartCoroutine(TaskChangedCoroutine());
            }
        }
Esempio n. 28
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);
        }
Esempio n. 29
0
        /// <summary>
        /// 进行命中效果的展示
        /// </summary>
        IEnumerator HitEffectRoutine()
        {
            DBSkillSev.SkillInfoSev skillInfo = DBSkillSev.Instance.GetSkillInfo(this.SkillID);
            if (skillInfo == null)
            {
                yield break;
            }

            // 普通伤害数值,如果有伤害分片,则将其添加到多段伤害的列表中
            if (mDamageSplitValues == null)
            {
                if (skillInfo.MultiHitRatios != null)
                {
                    mDamageSplitValues = new List <int>(skillInfo.MultiHitRatios.Count);
                    int leave_num = DamageValue;
                    for (int i = 0; i < skillInfo.MultiHitRatios.Count; ++i)
                    {
                        int show_damage = (int)(DamageValue * skillInfo.MultiHitRatios[i]);
                        if (i == (skillInfo.MultiHitRatios.Count - 1) && leave_num > show_damage)
                        {
                            show_damage = leave_num;//最后一下,弥补伤害;防止出现多段伤害:0 + 0,最终伤害是 1 的情况
                        }
                        mDamageSplitValues.Add(show_damage);
                        leave_num -= show_damage;
                    }
                }
                else
                {
                    mDamageSplitValues = new List <int>(1);
                    mDamageSplitValues.Add(DamageValue);
                }
            }

            // 特殊状态的伤害数值,如果有伤害分片,则将其添加到多段状态的列表中
            if (this.DamageSpecs != null && mDamageSpecsSplitValues == null)
            {
                if (skillInfo.MultiHitRatios != null)
                {
                    mDamageSpecsSplitValues = new List <Dictionary <uint, int> >();
                    for (int i = 0; i < skillInfo.MultiHitRatios.Count; ++i)
                    {
                        mDamageSpecsSplitValues.Add(new Dictionary <uint, int>());
                    }

                    // 需要进行合并处理的特殊状态(不进行分段显示)
                    Dictionary <uint, int> combineSpecValues = null;
                    foreach (var item in DamageSpecs)
                    {
                        if (DBDamageEffect.Instance.IsCombineValue(item.Key))
                        {
                            if (combineSpecValues == null)
                            {
                                combineSpecValues = new Dictionary <uint, int>();
                            }

                            combineSpecValues[item.Key] = item.Value;
                        }
                    }

                    //对每一个特殊状态进行分段处理
                    foreach (var item in DamageSpecs)
                    {
                        if (DBDamageEffect.Instance.IsCombineValue(item.Key))
                        {
                            continue;
                        }

                        uint state_type = item.Key;
                        int  leave_num  = item.Value;
                        for (int i = 0; i < skillInfo.MultiHitRatios.Count; ++i)
                        {
                            int show_damage = (int)(item.Value * skillInfo.MultiHitRatios[i]);
                            if (i == (skillInfo.MultiHitRatios.Count - 1) && leave_num > show_damage)
                            {
                                show_damage = leave_num;//最后一下,弥补伤害;防止出现多段伤害:0 + 0,最终伤害是 1 的情况
                            }
                            mDamageSpecsSplitValues[i].Add(state_type, show_damage);
                            leave_num -= show_damage;
                        }
                    }

                    // 将合并的伤害数值添加到最后
                    if (combineSpecValues != null && mDamageSpecsSplitValues.Count > 0)
                    {
                        var last       = mDamageSpecsSplitValues.Count - 1;
                        var lastValues = mDamageSpecsSplitValues[last];
                        foreach (var item in combineSpecValues)
                        {
                            lastValues[item.Key] = item.Value;
                        }
                    }
                }
                else
                {
                    mDamageSpecsSplitValues = new List <Dictionary <uint, int> >(1);
                    mDamageSpecsSplitValues.Add(DamageSpecs);
                }
            }

            if (mDamageSplitValues.Count <= 0)
            {
                GameDebug.LogError("HitEffect is excute when splitvalues is empty.");
                yield break;
            }

            // 当前伤害数值
            int cur_damage_value = mDamageSplitValues[0];

            mDamageSplitValues.RemoveAt(0);

            // 当前特殊伤害效果数值
            var curSpecsValues = mDamageSpecsSplitValues[0];;

            mDamageSpecsSplitValues.RemoveAt(0);

            var src_actor    = src;
            var target_actor = target;

            if (target_actor != null && target_actor.transform != null)
            {
                if ((this.DamageEffectType & (uint)Damage.EDamageEffect.DE_NOHIT) != 0)             // 闪避
                {
                    if ((this.DamageEffectType & (uint)Damage.EDamageEffect.DE_ABSOLUTE_DOGE) != 0) // 绝对闪避
                    {
                        target_actor.ShowDamageEffect(FightEffectHelp.FightEffectType.AbsoluteDoge, SrcID);
                    }
                    else if ((this.DamageEffectType & (uint)Damage.EDamageEffect.DE_DODGE) != 0)// 闪避
                    {
                        target_actor.ShowDamageEffect(FightEffectHelp.FightEffectType.Dodge, SrcID);
                    }
                    else if ((this.DamageEffectType & (uint)Damage.EDamageEffect.DB_FIVE_ATTR) != 0)// 五行属性不足
                    {
                        if (src_actor.IsLocalPlayer)
                        {
                            ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_FIVE_ATTR_NOENOUGH, null);
                        }
                    }
                }
                else
                {
                    // 攻击者进入战斗状态
                    if (src_actor != null)
                    {
                        src_actor.OnBattleTrigger();
                    }

                    // 伤害数字飘字
                    bool isCritic = (this.DamageEffectType & (uint)Damage.EDamageEffect.DE_CRITIC) != 0;
                    target_actor.DoDamage(SrcID, cur_damage_value, 0, isCritic, this.DamageEffectType);

                    // 受击效果飘字
                    if ((this.DamageEffectType == (uint)Damage.EDamageEffect.DE_BLOCK))//招架效果,需要显示伤害数字
                    {
                        BeattackedCtrl.ShowDamageEffect(this, (uint)Damage.EDamageEffect.DE_BLOCK, cur_damage_value);
                    }
                    else if ((this.DamageEffectType == (uint)Damage.EDamageEffect.DE_SUPER)) //无敌
                    {
                        BeattackedCtrl.ShowDamageEffect(this, (uint)Damage.EDamageEffect.DE_BLOCK, cur_damage_value);
                    }

                    // 附加伤害效果飘字
                    if (curSpecsValues != null)
                    {
                        foreach (var kv in curSpecsValues)
                        {
                            BeattackedCtrl.ShowDamageEffect(this, kv.Key, (int)kv.Value);
                        }
                    }

                    // 无敌类型不表现受击动作
                    if (this.DamageEffectType != (uint)Damage.EDamageEffect.DE_SUPER)
                    {
                        target_actor.Beattacked(this);
                    }

                    // 受击特效
                    if (!ShieldManager.Instance.IsHideBeattackEffect(src_actor, target_actor))
                    {
                        AnimationEffect.ResInitData effect_init_data = null;
                        if (skillInfo.BattleFxInfo != null)
                        {
                            effect_init_data = skillInfo.BattleFxInfo.BeattackEffectData;
                        }
                        else
                        {
                            effect_init_data              = new AnimationEffect.ResInitData();
                            effect_init_data.BindNode     = "root_node";
                            effect_init_data.FollowTarget = true;
                            effect_init_data.Effect       = string.Format("{0}.prefab", GameConstHelper.GetString("GAME_COMMON_BEATTACK_EFFECT"));
                            effect_init_data.Audio        = GameConstHelper.GetString("GAME_COMMON_BEATTACK_SOUND");
                            effect_init_data.EndTime      = 3.0f;
                        }
                        target_actor.ShowDamageEffectModel(effect_init_data);
                    }
                }
            }

            if (mDamageSplitValues.Count > 0)
            {
                float delay = 0.1f;
                if (skillInfo.MultiHitDelayTimes != null)
                {
                    delay = skillInfo.MultiHitDelayTimes[skillInfo.MultiHitRatios.Count - mDamageSplitValues.Count];
                }
                float attackspeed = 1.0f;
                if (src_actor != null)
                {
                    attackspeed = src_actor.AttackSpeed;
                }
                yield return(new SafeCoroutine.SafeWaitForSeconds(delay / attackspeed));

                SafeCoroutine.CoroutineManager.StartCoroutine(HitEffectRoutine());
            }
        }
Esempio n. 30
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);
            }
        }