Beispiel #1
0
 public void OnEventConnectStart(GameEvent ge, EventParameter parameter)
 {
     LogMgr.UnityLog("OnEventConnectStart");
     //MainPanelMgr.Instance.ShowDialog("WaitDialog");
     CancelInvoke("ConnectTimeOut");
     Invoke("ConnectTimeOut", 10);
 }
Beispiel #2
0
        IEnumerator _bossEnter(int resID)
        {
            //等待场景加载完才播boss 动画
            while (CoreEntry.bLoadSceneComplete != true)
            {
                LogMgr.UnityLog("等待场景加载完才播boss 动画 ");
                yield return(new WaitForSeconds(0.1f));
            }

            yield return(new WaitForSeconds(0.1f));

            CoreEntry.gGameMgr.pauseGame();

            yield return(new WaitForSeconds(0.5f));

            if (m_isCameraMoving == false)
            {
            }
            else
            {
                yield break;
            }

            yield return(new WaitForSeconds(3.2f));

            CoreEntry.gGameMgr.resumeGame();
        }
Beispiel #3
0
        // Send按钮单击事件
        public void SendBtnClick(GameObject btnObj)
        {
            // 获取内容
            if (mInput)
            {
                string strText = NGUIText.StripSymbols(mInput.text);
                if (!string.IsNullOrEmpty(strText))
                {
                    LogMgr.UnityLog("input: " + strText);

                    LogToBuff(DEBUG_TYPE.DEBUG_GM, LOG_TYPE.LOG_NULL, strText);

                    string[] cmdstr = strText.Split("\r\n".ToCharArray());
                    for (int i = 0; i < cmdstr.Length; ++i)
                    {
                        string cmd = cmdstr[i].Trim();
                        if (!string.IsNullOrEmpty(cmd))
                        {
                            mGmMgr.GmReq(cmd);
                        }
                    }
                    mInput.text = "";
                }
            }
        }
Beispiel #4
0
        //创建一个空的xml
        public bool CreateXml(string filePath)
        {
            LogMgr.UnityLog("filepath=" + filePath);

            if (File.Exists(filePath))
            {
                LogMgr.UnityLog("filPath is exist!");
                return(false);
            }

            //创建xml文档
            XmlDocument xmlDoc = new XmlDocument();

            XmlDeclaration declare = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "yes");

            xmlDoc.AppendChild(declare);

            //创建root文档
            XmlElement root = xmlDoc.CreateElement("root");

            xmlDoc.AppendChild(root);

            //保存
            xmlDoc.Save(filePath);

            return(true);
        }
Beispiel #5
0
        public bool CollectDataFromDBC(string file, string rootLabel)
        {
            bool result = true;

            DBC document = new DBC();

            document.Load(HomePath.GetAbsolutePath(file));

            for (int index = 0; index < document.RowNum; index++)
            {
                DBC_Row node = document.GetRowByIndex(index);
                if (node != null)
                {
                    TData  data = new TData();
                    bool   ret  = data.CollectDataFromDBC(node);
                    string info = string.Format("DataTableMgr.CollectDataFromDBC collectData Row:{0} failed!", index);
                    LogMgr.UnityLog(info);
                    //CoreEntry.gLogMgr.Log(LogLevel.ERROR, "Excepton", info);

                    if (ret)
                    {
                        m_DataContainer.Add(data);
                    }
                    else
                    {
                        result = false;
                    }
                }
            }

            return(result);
        }
Beispiel #6
0
        /// <summary>
        /// C->S 难度刷新 msgId:3165;
        ///  刷新类型 0:客户端申请列表 1:银两 2:元宝;
        /// </summary>
        /// <param name="type"></param>
        public void Send_CS_TongJiRefresh(int type)
        {
            LogMgr.UnityLog("请求通缉");
            MsgData_cTongJiLvlRefresh rsp = new MsgData_cTongJiLvlRefresh();

            rsp.type = type;
            CoreEntry.netMgr.send((Int16)NetMsgDef.C_TongJiLvlRefresh, rsp);
        }
Beispiel #7
0
        // Use this for initialization
        void Start()
        {
            LogMgr.UnityLog("===== NetMgr start !!! ");

            m_reconnect = new NetReconnect();
            m_reconnect.netClientThread = null;
            // 各系统注册网路消息
            //MainRole.Instance.RegisterNetMsg();
        }
Beispiel #8
0
 private void genKey()
 {
     LogMgr.UnityLog("genKey:" + m_nSelfSalt + " " + m_nTargetSalt);
     if (m_nSelfSalt != 0 && m_nTargetSalt != 0)
     {
         m_nKey = (m_nSelfSalt ^ m_nTargetSalt) + 3397;
         //BitConverter.GetBytes(m_nKey).CopyTo(m_sKeybuff,0);
         Utils.WriteUInt32(m_sKeybuff, 0, (uint)m_nKey);
         LogMgr.UnityLog("m_sKeybuff:" + BitConverter.ToString(m_sKeybuff));
     }
 }
Beispiel #9
0
 //
 public void onConnected(bool isSuccessfull, IPEndPoint remote)
 {
     if (isSuccessfull == false)
     {
         LogMgr.LogError("===== connect server failed !!! " + m_page + " address:" + remote.ToString());
     }
     else
     {
         LogMgr.UnityLog("===== connect server success !!! " + m_page + " address:" + remote.ToString());
     }
 }
Beispiel #10
0
        //编辑器使用
    #if UNITY_EDITOR
        public void FogShowEditor()
        {
            LogMgr.UnityLog("FogShowEditor()");

            Shader.EnableKeyword("_FOG_ON");
            Shader.SetGlobalColor("_HeightFogColor", heightFogColor);
            Shader.SetGlobalColor("_DistanceFogColor", distanceFogColor);
            Vector4 fogParam = new Vector4(top, bottom, near, far);

            Shader.SetGlobalVector("_FogParam", fogParam);
        }
Beispiel #11
0
        /**
         * @brief 载入文件
         *
         * @param path
         *
         * @return
         */
        public bool Load(string path)
        {
            bool ret = false;

            if (path == "")
            {
                return(ret);
            }

            Stream       ms = null;
            StreamReader sr = null;

            try {
                ms = FileReaderProxy.ReadFileAsMemoryStream(path);
                if (ms == null)
                {
                    string info = string.Format("DBC, Warning, Load file error or file is empty: {0}", path);
                    LogMgr.UnityLog("Excepton " + info);

                    //CoreEntry.gLogMgr.Log(LogLevel.WARNING, "Excepton", info);
                    return(false);
                }

                m_FileName = path;
                ms.Seek(0, SeekOrigin.Begin);
                m_FileSize = ms.Length;
                if (m_FileSize <= 0 || m_FileSize >= int.MaxValue)
                {
                    return(ret);
                }

                System.Text.Encoding encoding = System.Text.Encoding.UTF8;
                sr = new StreamReader(ms, encoding);

                ret = LoadFromStream(sr);
                ret = true;
            } catch (Exception e) {
                string err = "Exception:" + e.Message + "\n" + e.StackTrace + "\n";
                LogMgr.UnityLog(err);
                System.Diagnostics.Debug.WriteLine(err);
            } finally {
                if (sr != null)
                {
                    sr.Close();
                }
                if (ms != null)
                {
                    ms.Close();
                }
            }

            return(ret);
        }
Beispiel #12
0
        //吟唱阶段,自动转向目标
        void AutoLookatTarget()
        {
            ActorObj aimActorObj = m_actor.GetAttackObj();

            if (aimActorObj == null)
            {
                LogMgr.UnityLog("AutoLookatTarget() no target");
                return;
            }

            m_actor.FaceTo(aimActorObj.thisGameObject.transform.position);
        }
Beispiel #13
0
        public IEnumerator _FastMoveToTarget(int cfgID)
        {
            ActorObj actorBase = CoreEntry.gActorMgr.GetActorByConfigID(cfgID);

            if (actorBase == null)
            {
                LogMgr.UnityError("找不到怪物ID:" + cfgID);
                yield break;
            }


            CameraFollow cameraFollow = null;

            if (null != MainCamera)
            {
                cameraFollow = MainCamera.GetComponent <CameraFollow>();
            }
            if (cameraFollow == null)
            {
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_TASK_Camera_end, null);
                yield break;
            }

            lastDistance = cameraFollow.m_distance;
            lastHeight   = cameraFollow.m_height;

            CoreEntry.gGameMgr.pauseGame();

            yield return(new WaitForSeconds(0.6f));


            //TweenAttr2.SetAttr fnSetHeight = new TweenAttr2.SetAttr(cameraFollow.SetHeight);
            //TweenAttr.SetAttr fnSetDistance = new TweenAttr.SetAttr(cameraFollow.SetDistance);

            float distance = cameraFollow.getDistance(actorBase.transform);

            if (distance < 10)
            {
                cameraSpeed = 4;
            }
            else if (distance < 20)
            {
                cameraSpeed = 6;
            }
            LogMgr.UnityLog("镜头速度调整为:" + cameraSpeed);

            //播放动作
            yield return(new WaitForSeconds(1.9f));

            //通知剧情, 镜头已经移动到目标
            CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_TASK_Camera_Focus, null);
        }
Beispiel #14
0
        /// <summary>
        /// 非线程安全,必须主线程调用
        /// </summary>
        public void ConnectAsyncWithIp()
        {
            if (IsTcpClientConnected())
            {
                Disconnect();
                Start();
            }

            m_currentTry = new ConnectTry();

            LogMgr.UnityLog(string.Format("ConnectAsyncWithIp m_prepareConnect = true ip:{0} port:{1}", m_serverIP, m_serverPort));
            PrepareToConnect();
        }
Beispiel #15
0
 private void _ConnectAsyncWithIp()
 {
     LogMgr.UnityLog(string.Format("_ConnectAsyncWithIp m_currentTry.tryCount:", m_currentTry.tryCount));
     if ((--m_currentTry.tryCount) > 0)
     {
         LogMgr.UnityLog("beginconnect");
         syncConnect(m_serverIP, m_serverPort);
     }
     else //所有尝试均失败
     {
         ConnectFailed();
     }
 }
Beispiel #16
0
 private void _ConnectAsyncWithUrl()
 {
     if (m_currentTry.remoteHost.Count != 0)
     {
         IPAddress add = m_currentTry.remoteHost.Dequeue();
         LogMgr.UnityLog(string.Format("HttpMgr._ConnectAsync: try url: {0}", add.ToString()));
         //m_tcpClient.BeginConnect(add, m_serverPort, new AsyncCallback(CallBackMethod), this);
         syncConnect(add, m_serverPort);
     }
     else //所有尝试均失败
     {
         ConnectFailed();
     }
 }
Beispiel #17
0
        public float GetActionLength(string strAction)
        {
            if (strAction == null || strAction.Length == 0)
            {
                return(0.0f);
            }
            if (m_Animation[strAction] == null)
            {
                LogMgr.UnityLog("GetActionLength:" + strAction);
                return(0.0f);
            }

            return(m_Animation[strAction].length);
        }
Beispiel #18
0
            protected override void Main()
            {
                LogMgr.UnityLog("NetMgr.SenderThread.Main: Begin");

                while (!IsTerminateFlagSet())
                {
                    bool       sleep  = false;
                    SendBuffer buffer = null;

                    lock (m_sendMsgs)
                    {
                        if (m_sendMsgs.Count > 0)
                        {
                            buffer = m_sendMsgs.Dequeue();
                        }
                        else
                        {
                            sleep = true;
                            //LogMgr.UnityError("======sendMsgs.Count ==0 =====");
                        }
                    }
                    if (buffer != null)
                    {
                        try
                        {
                            NetStream.Write(buffer.msg, 0, buffer.Length);
                            NetStream.Flush();
                        }
                        catch (IOException e)
                        {
                            LogMgr.UnityError("SenderThread, Message: " + e.Message);
                            LogMgr.UnityError("SenderThread, StackTrace: " + e.StackTrace);
                            LogMgr.UnityError("SenderThread, InnerException.Message: " + e.InnerException.Message);
                        }

                        lock (cacheSendMsgs)
                        {
                            cacheSendMsgs.Cache(buffer);
                        }
                    }

                    if (sleep)
                    {
                        Thread.Sleep(15);
                    }
                }

                LogMgr.UnityLog("NetMgr.SenderThread.Main: End");
            }
Beispiel #19
0
        public void SetActionTime(string strAction, float timeValue)
        {
            if (strAction == null || strAction.Length <= 0)
            {
                return;
            }

            if (m_Animation[strAction] == null)
            {
                LogMgr.UnityLog("SetActionTime:" + strAction);
                return;
            }

            m_Animation[strAction].time = timeValue;
        }
Beispiel #20
0
        public void SetActionSpeed(string strAction, float speed)
        {
            if (strAction == null || strAction.Length <= 0)
            {
                return;
            }

            if (m_Animation[strAction] == null)
            {
                LogMgr.UnityLog("SetActionSpeed:" + strAction);
                return;
            }

            m_Animation[strAction].speed = speed;
        }
Beispiel #21
0
        public void PushToPool(int resID, string ext, int maxNum = 20, bool isDelOldOne = false)
        {
            if (m_ObjectPool.ContainsKey(resID))
            {
                if (isDelOldOne)
                {
                    m_ObjectPool.Remove(resID);
                }
                else
                {
                    return;
                }
            }

            GameObject obj  = null;
            GameObject root = ObjectPoolRoot;

            //Configs.modelConfig modelConfig = CSVConfigManager.GetmodelConfig(resID);
            LuaTable cfg = ConfigManager.Instance.Common.GetModelConfig(resID);

            if (cfg == null)
            {
                return;
            }
            else
            {
                string path = cfg.Get <string>("skl");
                if (ext != null && ext.Length > 0)
                {
                    path += ext;
                }
                //Debug.LogError ("====PushToPool==path="+path);
                obj = (GameObject)(CoreEntry.gResLoader.LoadResource(path));
            }
            if (obj)
            {
                GameObjectPool objpool = new GameObjectPool(obj, root, 1, 1, maxNum);
                if (!m_ObjectPool.ContainsKey(resID))
                {
                    m_ObjectPool.Add(resID, objpool);
                }
            }
            else
            {
                LogMgr.UnityLog("");
            }
        }
Beispiel #22
0
        //1001,1#1002,2
        public string DropItemToString()
        {
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < DropItem.Count; i++)
            {
                sb.Append(DropItem[i].ItemID);
                sb.Append(",");
                sb.Append(DropItem[i].Count);
                if (i != DropItem.Count - 1)
                {
                    sb.Append("#");
                }
            }
            LogMgr.UnityLog(sb.ToString());
            return(sb.ToString());
        }
Beispiel #23
0
        public bool MiaoGuai()
        {
            LogMgr.UnityLog("call GmMgr MiaoGuai");

            SkillMgr gSkillMgr = CoreEntry.gSkillMgr;

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

            return(true);
        }
Beispiel #24
0
        public bool ShowSkillScope()
        {
            LogMgr.UnityLog("call GmMgr ShowSkillScope");

            SkillMgr gSkillMgr = CoreEntry.gSkillMgr;

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

            return(true);
        }
Beispiel #25
0
        //public bool RecordNet()
        //{
        //    LogMgr.UnityLog("call GmMgr RecordNet");

        //    if (CoreEntry.netMgr.m_recordNet)
        //    {
        //        CoreEntry.netMgr.StopRecordingNet();
        //    }
        //    else
        //    {
        //        CoreEntry.netMgr.StartRecordingNet();
        //    }



        //    return true;
        //}

        public bool SwitchSoundEffect()
        {
            LogMgr.UnityLog("call GmMgr Sound Effect");

            if (CoreEntry.SoundEffectMgr.OnlyPlayOneSample)
            {
                CoreEntry.SoundEffectMgr.OnlyPlayOneSample = false;
            }
            else
            {
                CoreEntry.SoundEffectMgr.OnlyPlayOneSample = true;
            }



            return(true);
        }
Beispiel #26
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");
            }
        }
Beispiel #27
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);
        }
Beispiel #28
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");
            }
Beispiel #29
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);
        }
Beispiel #30
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);
        }