Example #1
0
        public bool bindMsgExHandler(Int16 cmd, MsgExHandler handler)
        {
            MsgExHandler handlerEvent;

            if (msgExHandlers.TryGetValue(cmd, out handlerEvent))
            {
#if UNITY_EDITOR
                LogMgr.LogError("网络扩展消息处理重复注册:{0}", cmd);
#endif
                return(false);
            }
            else
            {
                msgExHandlers.Add(cmd, handler);

                return(true);
            }
        }
Example #2
0
        public void OnGetWaBaoReward(GameEvent ge, EventParameter parameter)
        {
            LogMgr.LogError("receive GetWaBaoReward");
            MsgData_sGetWaBaoReward resp = parameter.msgParameter as MsgData_sGetWaBaoReward;

            if (resp.result == 0)
            {
                MsgData_sBossWabaoList tt = new MsgData_sBossWabaoList();
                tt.bossId            = resp.bossId;
                tt.num               = resp.num;
                wabaoList[tt.bossId] = tt;
            }
            else
            {
                LogMgr.LogError("探宝失败");
            }
            CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_CC_WorldBossGetReward, parameter);
        }
Example #3
0
        /// <summary>
        /// 副本结束。
        /// </summary>
        /// <param name="data">网络消息数据。</param>
        private void OnLevelEnd(MsgData data)
        {
            MsgData_sBackZhiYuanFbEnd info = data as MsgData_sBackZhiYuanFbEnd;

            LogMgr.LogWarning("OnLevelEnd result:{0} level:{1} mCurID:{2}", info.Result, info.Level, mCurID);
            if (mCurID == 0)
            {
                //会收到多条结束消息
                return;
            }

            //成功才扣次数
            if (info.Result == 1)
            {
                SubChapterNumber(mCurID, 1);
            }

            //修改信息
            int id = mCurID;
            MsgData_sStagevo stage = GetStageInfo(mCurID);
            bool             first = stage == null;

            if (first)
            {
                stage    = new MsgData_sStagevo();
                stage.ID = mCurID;
                mStageInfo.Add(stage.ID, stage);
            }
            if (stage.Evaluate <= 0)
            {
                first = true;
            }
            stage.Evaluate = info.Level;
            mCurID         = 0;
            CoreEntry.gAutoAIMgr.AutoFight = false;

            //挑战通知
            EventParameter ep = EventParameter.Get();

            ep.intParameter  = info.Result;
            ep.intParameter1 = id;
            ep.intParameter2 = first ? 1 : 0;
            CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_RESLEVEL_END, ep);
        }
Example #4
0
        /// <summary>
        /// 使用属性丹。
        /// </summary>
        /// <param name="data">网络消息数据。</param>
        private void OnUseAttrDan(MsgData data)
        {
            MsgData_sUseAttrDan info = data as MsgData_sUseAttrDan;

            LogMgr.LogError(string.Format("OnUseAttrDan type:{0} result:{1} pillnumber:{2}", info.Type, info.Result, info.PillNumber));
            if (info.Result == 0)
            {
                if (info.Type == AttrDanType.Ride)
                {
                    mPillNum = info.PillNumber;
                    TriggerEventRideUseAttrDan(info.Type);
                }
                else if (info.Type == AttrDanType.RidePer)
                {
                    mPillNumPercent = info.PillNumber;
                    TriggerEventRideUseAttrDan(info.Type);
                }
            }
        }
Example #5
0
        /// <summary>
        /// 更改坐骑状态。
        /// </summary>
        /// <param name="data">网络消息数据。</param>
        private void OnChangeRideState(MsgData data)
        {
            MsgData_sChangeRideState info = data as MsgData_sChangeRideState;

            if (RideState != info.RideState)
            {
                RideState = info.RideState;
                TriggerEventRideStageChange(RideState);
                if (RideState == 1)
                {
                    CoreEntry.gAudioMgr.PlayUISound(900009);
                }
                else
                {
                    CoreEntry.gAudioMgr.PlayUISound(900010);
                }
                LogMgr.Log(string.Format("OnChangeRideState state:{0}", RideState));
            }
        }
Example #6
0
        /// <summary>
        /// 显示模型。
        /// </summary>
        /// <param name="skin">坐骑编号。</param>
        public void ShowModel(int skin)
        {
            Animation mAnimator = null;

            if (mCurID == skin)
            {
                mAnimator = mRide.GetComponent <Animation>();
                if (null != mAnimator)
                {
                    //mAnimator.Play(mIdleActionName);
                    bFinishReturn = true;
                }
                return;
            }

            string     path   = ConfigManager.Instance.Ride.GetRideSkin(skin, true);
            GameObject prefab = (GameObject)CoreEntry.gResLoader.Load(path, typeof(GameObject));

            if (prefab == null)
            {
                LogMgr.ErrorLog("加载坐骑失败 skin:{0} path:{1}", skin, path);
                return;
            }

            mCurID = skin;
            if (mRide != null)
            {
                Destroy(mRide);
            }
            mRide = Instantiate(prefab) as GameObject;
            mRide.transform.SetParent(ModelParent);
            mRide.transform.localPosition = Vector3.zero;
            mRide.transform.localScale    = Vector3.one;
            mRide.transform.forward       = ModelParent.forward;
            mAnimator = mRide.GetComponent <Animation>();
            SetCfgPosition();
            //  if (null != mAnimator)
            //   {
            //      Debug.LogError("ID不相同");
            //      mAnimator.Play(mEnterActionName);
            //       bFinishReturn = true;
            //   }
        }
Example #7
0
        public bool WuShang()
        {
            LogMgr.UnityLog("call GmMgr WuShang");

            SkillMgr gSkillMgr = CoreEntry.gSkillMgr;

            if (gSkillMgr.m_bWuShang)
            {
                gSkillMgr.m_bWuShang = false;
            }
            else
            {
                gSkillMgr.m_bWuShang = true;
            }



            return(true);
        }
Example #8
0
        public static void CreateMagicKey(ActorObj attackObj, int skillID)
        {
            GameObject efxObj       = null;
            LuaTable   skill_action = CoreEntry.gSkillMgr.GetSkillActon(skillID);

            if (skill_action != null)
            {
                object obj = CoreEntry.gResLoader.LoadResource(skill_action.Get <string>("skilleffect"));
                if (obj == null)
                {
                    LogMgr.LogError("找不到attackEfxPrefab:" + skill_action.Get <string>("skilleffect"));
                }

                efxObj = Instantiate((GameObject)obj) as GameObject; //CoreEntry.gGameObjPoolMgr.InstantiateEffect(param.actionEfx);
                if (efxObj != null)
                {
                    efxObj.transform.parent = attackObj.transform;

                    efxObj.transform.localPosition = Vector3.zero;
                    //efxObj.transform.localRotation = Vector3.zero;
                    efxObj.transform.localScale = Vector3.one;
                }
            }
            if (efxObj != null)
            {
                SkillMagicKeyBase mk = efxObj.GetComponent <SkillMagicKeyBase>();
                if (mk == null)
                {
                    mk = efxObj.AddComponent <SkillMagicKeyBase>();
                }
                mk.Init(attackObj, skillID);
            }

            LuaTable skillCfg = ConfigManager.Instance.Skill.GetSkillConfig(skillID);

            if (null != skillCfg && skillCfg.Get <int>("showtype") == (int)SkillShowType.ST_MAGICKEY)
            {
                EventParameter param = EventParameter.Get();
                param.intParameter    = skillCfg.Get <int>("showtype");
                param.stringParameter = skillCfg.Get <string>("name");
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_FLY_SKILL, param);
            }
        }
Example #9
0
        public void ShowDress(int dress)
        {
            if (m_CurDress == dress)
            {
                return;
            }

            //清除武器和翅膀,武器是挂在人身上,不用手动Destroy
            mCurWeaponID = 0;
            mLeftWeapon  = null;
            mRightWeapon = null;
            mCurWing     = 0;
            mWing        = null;

            //清除模型
            Destroy(mPlayerObject);
            mPlayerObject = null;
            mRightHand    = null;
            mLeftHand     = null;
            mBackHolder   = null;

            //加载新模型
            m_CurDress = dress;
            if (m_CurDress == 0)
            {
                return;
            }

            mPlayerObject = SceneLoader.LoadModelObject(m_CurDress);
            if (mPlayerObject == null)
            {
                LogMgr.WarningLog("加载衣服id:{0}失败", m_CurDress);
                return;
            }

            mPlayerObject.transform.SetParent(ModelParent);
            mPlayerObject.transform.localPosition = Vector3.zero;
            mPlayerObject.transform.localScale    = Vector3.one;
            mPlayerObject.transform.forward       = ModelParent.forward;
            mRightHand  = ActorObj.RecursiveFindChild(mPlayerObject.transform, "DM_R_Hand");
            mLeftHand   = ActorObj.RecursiveFindChild(mPlayerObject.transform, "DM_L_Hand");
            mBackHolder = ActorObj.RecursiveFindChild(transform, "E_back");
        }
Example #10
0
        private void OnObjectDead(GameEvent ge, EventParameter parameter)
        {
            MsgData_sObjDeadInfo msg = parameter.msgParameter as MsgData_sObjDeadInfo;

            if (null == msg)
            {
                return;
            }

            ActorObj behitActor  = CoreEntry.gActorMgr.GetActorByServerID(msg.ID);
            ActorObj attackActor = CoreEntry.gActorMgr.GetActorByServerID(msg.KillerID);

            if (behitActor == CoreEntry.gActorMgr.MainPlayer)
            {
                StopHurtAnimation();
                mainplayerDead = true;
                LogMgr.UnityLog("HPBarBoss StopHurtAnimation");
            }
        }
Example #11
0
        /// <summary>
        /// 技能学习。
        /// </summary>
        /// <param name="data">网络消息数据。</param>
        private void OnSkillLearn(MsgData data)
        {
            MsgData_sSkillLearnResult info = data as MsgData_sSkillLearnResult;

            if (info.Result == 0)
            {
                int id  = info.ID;
                int gid = ConfigManager.Instance.Skill.GetSkillGroup(id);
                if (!mSkills.ContainsKey(gid))
                {
                    mSkills.Add(gid, id);
                }
                else
                {
                    LogMgr.ErrorLog("技能组重复 id:{0} gid:{1}", id, gid);
                }
            }
            TriggerEventSkillLean(info.Result, info.ID);
        }
Example #12
0
            protected override void Main()
            {
                LogMgr.UnityLog("NetMgr.ReceiverThread.Main: Begin");

                while (!IsTerminateFlagSet())
                {
                    try
                    {
                        ReadFromStream();
                        ScanPackets();
                    }
                    catch (Exception e)
                    {
                        LogMgr.LogError("rcv thread error:" + e);
                    }
                }

                LogMgr.UnityLog("NetMgr.ReceiverThread.Main: End");
            }
Example #13
0
 /// <summary>
 /// 场景中删除模型。。。。
 /// </summary>
 /// <returns>The load point.</returns>
 /// <param name="info">Info.</param>
 /// <param name="index">Index.</param>
 /// <param name="callback">Callback.</param>
 public void SceneDelePoint(int index, MonsterType tp)
 {
     if (!items.ContainsKey(tp))
     {
         LogMgr.LogError("类型错误");
         return;
     }
     if (items[tp].ContainsKey(index))
     {
         LogMgr.Log("已删除  " + index);
         GameObject t = items[tp][index];
         DestroyImmediate(t);
         items[tp].Remove(index);
     }
     else
     {
         LogMgr.LogError("找不到  " + index);
     }
 }
Example #14
0
        /// <summary>
        /// 改变翅膀。
        /// </summary>
        /// <param name="id">翅膀模型编号。</param>
        private void ChangeWing(int id)
        {
            if (mCurWing == id)
            {
                return;
            }

            if (mBackHolder == null)
            {
                mBackHolder = ActorObj.RecursiveFindChild(transform, "E_back");
            }

            //更新翅膀
            if (id != 0)
            {
                GameObject obj = SceneLoader.LoadModelObject(id);
                if (obj == null)
                {
                    LogMgr.WarningLog("加载翅膀id:{0}失败", id);
                    return;
                }

                //移除原来翅膀
                if (mWing != null)
                {
                    Destroy(mWing);
                    mWing = null;
                }

                //挂接新翅膀
                mWing = obj;
                mWing.transform.parent        = mBackHolder;
                mWing.transform.localPosition = Vector3.zero;
                mWing.transform.localRotation = Quaternion.identity;
                mWing.SetActive(true);
            }
            else
            {
                Destroy(mWing);
                mWing = null;
            }
            mCurWing = id;
        }
Example #15
0
        void OnTriggerEnter(Collider collider)
        {
            ActorObj actor = collider.GetComponent <ActorObj>();

            if (null == actor)
            {
                return;
            }
            if (actor != CoreEntry.gActorMgr.MainPlayer)
            {
                return;
            }

            if (m_IgnoreEnter)
            {
                return;
            }

            if (PlayerData.Instance.BaseAttr.Level < m_PortalCfg.Get <int>("limitLv"))
            {
                string msg = string.Format("人物等级不足{0}级,无法传送!", m_PortalCfg.Get <int>("limitLv"));
                UITips.ShowTips(msg);
                LogMgr.LogWarning(msg + "(客户端主动判断)");
                return;
            }
            if (PlayerData.Instance.BaseAttr.JingJieLevel < m_PortalCfg.Get <int>("dianfengLv"))
            {
                string msg = string.Format("人物境界等级不足{0}级,无法传送!", m_PortalCfg.Get <int>("dianfengLv"));
                UITips.ShowTips(msg);
                LogMgr.LogWarning(msg + "(客户端主动判断)");
                return;
            }
            if (m_PortalCfg.Get <int>("type") == 3)   //活动地图传送门 --世界BOSS,银两BOSS等
            {
                ActivityMgr.Instance.Send_CS_ActivityEnter(m_PortalCfg.Get <int>("targetActivity"));
            }
            else
            {
                //
                CoreEntry.gActorMgr.MainPlayer.StopMove(true);
                NetLogicGame.Instance.SendReqStaticTrigger(serverID);
            }
        }
Example #16
0
        public Vector3 GetCurveMoveEndPosition(string clipName)
        {
            if (m_animationCurveData == null)
            {
                return(Vector3.zero);
            }

            //给定动画是否有位移曲线
            CurveData curveData = m_animationCurveData.GetCurveData(clipName);

            if (curveData == null)
            {
                LogMgr.UnityLog("can't find " + clipName + " curve data");
                return(Vector3.zero);
            }

            Vector3 endPos = Vector3.zero;

            //这里必须帧数一样
            for (int i = 0; i < curveData.curve.Length; ++i)
            {
                if (curveData.curve[i].propertyName.Contains("m_LocalPosition.x"))
                {
                    AnimationCurve tempX = curveData.curve[i].curve;

                    endPos.x = tempX.keys[tempX.length - 1].value;
                }
                else if (curveData.curve[i].propertyName.Contains("m_LocalPosition.y"))
                {
                    AnimationCurve tempY = curveData.curve[i].curve;
                    endPos.y = tempY.keys[tempY.length - 1].value;
                }
                else if (curveData.curve[i].propertyName.Contains("m_LocalPosition.z"))
                {
                    AnimationCurve tempZ = curveData.curve[i].curve;
                    endPos.z = tempZ.keys[tempZ.length - 1].value;
                }
            }

            endPos = m_transform.rotation * endPos + m_transform.position;

            return(endPos);
        }
Example #17
0
        /*
         *  创建贴花
         */
        static WarningDecel Create(string DecelPerferb, Vector3 wordPositon)
        {
            GameObject go = (GameObject)Instantiate(CoreEntry.gResLoader.LoadResource(DecelPerferb));

            if (go)
            {
                WarningDecel wd = go.AddComponent <WarningDecel>(); //go.GetComponent<WarningDecel>() as WarningDecel;
                if (wd)
                {
                    wd.Init(wordPositon, ref go);
                }
                return(wd);
            }
            else
            {
                LogMgr.UnityError("[WarningDecal Create Failed]");
                return(null);
            }
        }
Example #18
0
        public bool IsCastSkillOver(int nSkillID)
        {
            if (m_actor.curActorState == ACTOR_STATE.AS_ATTACK)
            {
                if (m_actor.GetComponent <Animation>().isPlaying == false && m_actor.m_bIsTower == false)
                {
                    LogMgr.UnityWarning("IsCastSkillOver.m_actor.animation.isPlaying == false :" + m_actor);
                    //如果在攻击状态没有动作,则视为技能施放完毕
                    return(true);
                }
            }
            else
            {
                return(true);
            }

            m_bNeedRandom = true;

            //判断连招
            StateParameter param = new StateParameter();

            param.state          = ACTOR_STATE.AS_ATTACK;
            param.skillID        = nSkillID;
            param.isComposeSkill = false;

            //是否组合技能
            ComposeSkillDesc composeSkillDesc = m_actor.m_gameDBMgr.GetComposeSkillDesc(m_actor.curCastSkillID, nSkillID);

            if (composeSkillDesc != null)
            {
                param.isComposeSkill   = true;
                param.composeSkillDesc = composeSkillDesc;
            }

            if (param.isComposeSkill)
            {
                bool bRet = m_actor.ComposeSkillCanCastSkill(param.composeSkillDesc.changeTime);
                return(bRet);
            }

            return(m_actor.curActorState != ACTOR_STATE.AS_ATTACK);
        }
Example #19
0
        /// <summary>
        /// 获取衣服模型。
        /// </summary>
        /// <param name="fashion">时装。</param>
        /// <param name="equip">装备。</param>
        /// <param name="job">职业。</param>
        /// <returns>按优先级获取的模型ID。</returns>
        public static int GetClothesModelID(int fashion, int equip, int job, int equipStarMin)
        {
            //衣服显示优先级 时装>装备>模型默认
            if (fashion != 0)
            {
                return(ConfigManager.Instance.BagItem.GetFashionModelID(fashion, job, equipStarMin));
            }

            //读取装备衣服,没有则读取角色默认衣服
            int dress = equip;

            if (dress == 0)
            {
                LuaTable cfg = ConfigManager.Instance.Actor.GetPlayerInfoConfig(job);
                if (cfg != null)
                {
                    dress = cfg.Get <int>("dress");
                }
            }
            if (dress == 0)
            {
                LogMgr.ErrorLog("角色职业默认衣服配置错误,衣服编号为0");
                return(0);
            }

            LuaTable equipCfg = ConfigManager.Instance.BagItem.GetEquipConfig(dress);

            if (null == equipCfg)
            {
                LogMgr.ErrorLog("没有找到编号为{0}的衣服", dress);
                return(0);
            }

            int modelid = EquipDataMgr.Instance.GetEquipStarModelID(job, equipStarMin);

            if (modelid == 0)
            {
                modelid = equipCfg.Get <int>(string.Format("vmesh{0}", job));
            }

            return(modelid);
        }
Example #20
0
        //private int type;

        public LineFormula(Node start, Node end, int type)
        {
            //this.type = type;

            if (start.position.x == end.position.x)
            {
                if (type == 1)
                {
                    a = 0;
                    b = start.position.x;
                }
                else
                {
                    LogMgr.LogError("LineFormula error");
                }
            }
            else if (start.position.y == end.position.y)
            {
                if (type == 0)
                {
                    a = 0;
                    b = start.position.y;
                }
                else
                {
                    LogMgr.LogError("LineFormula error");
                }
            }
            else
            {
                if (type == 0)
                {
                    a = (end.position.y - start.position.y) / (end.position.x - start.position.x);
                    b = start.position.y - a * start.position.x;
                }
                else if (type == 1)
                {
                    a = (end.position.x - start.position.x) / (end.position.y - start.position.y);
                    b = start.position.x - a * start.position.y;
                }
            }
        }
Example #21
0
        //打开文件
        public bool OpenXml(string filePath)
        {
            XmlDocument xmlDoc = new XmlDocument();

            //Object fileByte  = Resources.Load(filePath);
            TextAsset fileByte = CoreEntry.gResLoader.LoadTextAsset(filePath, SenLib.AssetType.Xml); //(TextAsset)CoreEntry.gResLoader.Load(filePath, typeof(TextAsset), 11);

            if (fileByte == null)
            {
                LogMgr.UnityLog("Error  加载XML 失败: " + filePath);
                return(false);
            }
            Encoding utf8NoBom = new UTF8Encoding(false);

            //StringBuilder builder = new StringBuilder();
            //builder.Append(utf8NoBom.GetString(fileByte.bytes, 0, fileByte.bytes.Length ));
            //builder.Append("\n\n");
            string strXml = utf8NoBom.GetString(fileByte.bytes, 0, fileByte.bytes.Length);

            //string strXml =builder.ToString();


            //Encoding encoding = Encoding.UTF8; //Encoding.ASCII;//
            //StreamReader sr = new StreamReader(new MemoryStream(fileByte.bytes), encoding);

            try
            {
                xmlDoc.LoadXml(strXml);
            }
            catch (System.Exception e)
            {
                LogMgr.LogError("error!  load XML   path:" + filePath + "     \n" + e);
                return(false);
            }

            //调整filepath,绝对路径
            m_filePath = Application.dataPath + @"/ResData/" + filePath + @".xml";

            m_xmlDoc = xmlDoc;

            return(true);
        }
Example #22
0
        private void OnRevive(GameEvent ge, EventParameter parameter)
        {
            MsgData_sRevive data = parameter.msgParameter as MsgData_sRevive;

            if (null == data)
            {
                return;
            }

            if (0 == data.Result)
            {
                ActorObj actor = CoreEntry.gActorMgr.GetActorByServerID(data.RoleID);
                if (actor == CoreEntry.gActorMgr.MainPlayer)
                {
                    LogMgr.UnityLog("HPBarBoss ShowHurtAnimation");
                    mainplayerDead = false;
                    ShowHurtAnimation();
                }
            }
        }
Example #23
0
        public void RecyclePrefabInstance(T prefab)
        {
            if (prefab == null)
            {
                throw new System.ArgumentNullException("Cannot recycle null item!");
            }

            OnHandleRecyclePrefab(prefab);

            if (_availableInstances.Count < AvailablePrefabCountMaximum)
            {
                _availableInstances.Add(prefab);
            }
            UnrecycledPrefabCount--;

            if (UnrecycledPrefabCount < 0)
            {
                LogMgr.UnityLog("More items recycled than obtained");
            }
        }
Example #24
0
 /**
  * @brief 创建索引,默认第一列作为关键字
  *
  * @return
  */
 private void CreateIndex()
 {
     foreach (DBC_Row row in m_DataBuf)
     {
         if (row.Data != null && row.Data.Count > 0)
         {
             string key = row.Data[0];
             if (!m_HashData.ContainsKey(key))
             {
                 m_HashData.Add(key, row);
             }
             else
             {
                 string err = string.Format("DBC.CreateIndex FileName:{0} SameKey:{1}", m_FileName, key);
                 LogMgr.UnityLog(err);
                 System.Diagnostics.Debug.Assert(false, err);
             }
         }
     }
 }
Example #25
0
        // Use this for initialization
        public static void SendEvent(string sEvtName)
        {
            List <UIOnEvent> eventList;

            if (g_UIOnEventDict.TryGetValue(sEvtName, out eventList))
            {
                for (int i = 0; i < eventList.Count; ++i)
                {
                    g_strEvent = sEvtName;
                    try
                    {
                        eventList[i]();
                    }
                    catch (System.Exception e)
                    {
                        LogMgr.UnityError(e.ToString());
                    }
                }
            }
        }
Example #26
0
        //add by lzp 14:43 2016/10/11 开始重连检测在这个函数里
        private bool ConnectIfNeeded()
        {
            if (!m_isConnectted && m_reconnect != null &&
                MapMgr.Instance.CurMapType != MapMgr.MapType.Map_Login && MapMgr.Instance.CurMapType != MapMgr.MapType.Map_None)
            {
                LogMgr.DebugLog("ConnectIfNeeded : StartReconnect");
                m_reconnect.StartReconnect();
            }

            if (!IsTcpClientConnected() && (null == m_currentTry))
            {
#if (NETMGR_USE_IP_FOR_CON)
                ConnectAsyncWithIp();
#else
                ConnectAsyncWithUrl();
#endif
                return(true);
            }
            return(false);
        }
Example #27
0
        /// <summary>
        /// 技能列表刷新。
        /// </summary>
        /// <param name="data">网络消息数据。</param>
        private void OnSkillList(MsgData data)
        {
            MsgData_sSkillListResult info = data as MsgData_sSkillListResult;

            mSkills.Clear();
            for (int i = 0; i < info.Skills.Count; ++i)
            {
                int id  = info.Skills[i].ID;
                int gid = ConfigManager.Instance.Skill.GetSkillGroup(id);
                if (!mSkills.ContainsKey(gid))
                {
                    mSkills.Add(gid, id);
                }
                else
                {
                    LogMgr.ErrorLog("技能组重复 id:{0} gid:{1}", id, gid);
                }
            }
            TriggerEventSkillInfo();
        }
Example #28
0
        /**
         * @brief 从Xml节点中读取数值类型,使用时,必须在函数中指明数值类型
         *          如: int id = ExtractNumeric<int>(xmlNode, "Id", -1, true);
         *
         * @param node xml节点
         * @param nodeName 节点名字
         * @param defualtVal 默认值
         * @param isMust 是否强制不能为空
         *
         * @return
         */
        public static T ExtractNumeric <T>(DBC_Row node, string nodeName, T defualtVal, bool isMust)
        {
            T result = defualtVal;

            if (node == null || !node.HasFields || node.SelectFieldByName(nodeName) == null)
            {
                //if (isMust)
                //{
                //  string errorInfo = string.Format("ExtractNumeric Error node:{0} nodeName:{1}", node.RowIndex, nodeName);
                //  LogSystem.Assert(false, errorInfo);
                //}

                return(result);
            }

            string nodeText = node.SelectFieldByName(nodeName);

            if (Helper.StringIsNullOrEmpty(nodeText))
            {
                //if (isMust)
                //{
                //  string errorInfo = string.Format("ExtractNumeric Error node:{0} nodeName:{1}", node.RowIndex, nodeName);
                //  LogSystem.Assert(false, errorInfo);
                //}
            }
            else
            {
                try {
                    result = (T)Convert.ChangeType(nodeText, typeof(T));
                } catch (System.Exception ex) {
                    string info = string.Format("ExtractNumeric Error node:{0} nodeName:{1} ex:{2} stacktrace:{3}",
                                                node.RowIndex, nodeName, ex.Message, ex.StackTrace);
                    LogMgr.UnityLog(info);
                    //LogSystem.Debug(info);

                    Helper.LogCallStack();
                }
            }

            return(result);
        }
Example #29
0
        /// <summary>
        /// 加载图集。
        /// </summary>
        /// <param name="prefab">图集预制件路径。</param>
        /// <returns>图集的贴图集合。</returns>
        private Dictionary <string, Sprite> LoadAtlas(string prefab)
        {
            string     path = "UI/Atlas/" + prefab;
            GameObject obj  = (GameObject)CoreEntry.gResLoader.Load(path, typeof(GameObject));

            if (obj == null)
            {
                //Log.Warning("Can not found the prefab. path:{0}", prefab);
                return(null);
            }

            AtlasHolder holder = obj.GetComponent <AtlasHolder>();

            if (holder == null)
            {
                LogMgr.WarningLog("The prefab has not component of 'AtlasHolder'. path:{0}", prefab);
                return(null);
            }

            return(holder.GetSprites());
        }
Example #30
0
        public static void Log(string logString, string stackTrace, LogType type)
        {
            if (!m_isDebug)
            {
                return;
            }
            switch (type)
            {
            case LogType.Log:
                LogMgr.DebugLog(logString);
                break;

            case LogType.Warning:
                LogMgr.WarningLog(logString);
                break;

            case LogType.Error:
                LogMgr.ErrorLog(logString);
                break;
            }
        }