public static LogError ( object message ) : void | ||
message | object | |
return | void |
/// <summary> /// 各个系统通过传入配置文件名得到Protobuf类型的对象 /// </summary> /// <typeparam name="T">protobuf类型</typeparam> /// <param name="FileName">配置文件名</param> /// <returns>Protobuf类型的对象</returns> public static T ReadOneDataConfig <T>(string FileName, bool bRemain = false) { byte[] bytesData = null; if (!ms_dataStreamDict.ContainsKey(FileName)) { bytesData = GetDataStream(FileName); if (bRemain) { ms_dataStreamDict.Add(FileName, bytesData); } } else { bytesData = ms_dataStreamDict[FileName]; } if (!s_dr.ContainsKey(FileName)) { s_dr[FileName] = 0; } s_dr[FileName] += 1; if (!s_drAll.ContainsKey(FileName)) { s_drAll[FileName] = 0; } s_drAll[FileName] += 1; if (s_dr[FileName] > 1) { int tmp = 0; tmp++; } Stream stream = new MemoryStream(bytesData); T t = default(T); try { t = ReadOneDataConfig <T>(stream); } catch (System.Exception ex) { Debugger.LogError("反序列化失败, 请检查数据和解析类的一致性:" + FileName + ex.ToString()); } stream.Close(); return(t); }
protected override BTreeRunningStatus _DoExecute(BTreeTemplateData input, ref BTreeTemplateData output) { BTreeInputData _input = input as BTreeInputData; BTreeOutputData _output = output as BTreeOutputData; if (_input == null || _output == null) { Debugger.LogError("数据类型错误"); } return(BTreeRunningStatus.Executing); }
private bool LOBBY2CLIENT_REALTIME_FIGHT_DATA_RESP_HANDLER(Observers.Interfaces.INotification note) { RealTimeFightDataResp resp = note.Body as RealTimeFightDataResp; FightProxy.instance.fightId = resp.fightId; FightProxy.instance.randomSeed = resp.randomSeed; FightProxy.instance.SetData(resp.selfTeamData, resp.opponentTeamData); //FightController.instance.fightType = Enums.FightType.PVP; FightController.instance.fightType = Enums.FightType.ConsortiaFight; FightProxy.instance.consortiaOver = false; FightProxy.instance.isHome = resp.isHome; DataMessageHandler.DataMessage_ClearConsortiaSkills(); Debugger.Log("start consortia fight --------------------------------------------------------------"); _count = 0; for (int i = 0, count = resp.cmdList.Count; i < count; i++) { FightCmdSynResp fightCmdSynResp = resp.cmdList[i]; Dictionary <int, int> judgeDic = new Dictionary <int, int>(); Debugger.Log("character {0} skillId {1}", fightCmdSynResp.heroId, fightCmdSynResp.skillId); for (int j = 0, jCount = fightCmdSynResp.effectJudgeTypes.Count; j < jCount; j++) { DoubleIntProto dip = fightCmdSynResp.effectJudgeTypes[j]; Debugger.Log("character {0} target {1} judgeType {2}", fightCmdSynResp.heroId, dip.value1, dip.value2); judgeDic.Add(dip.value1, dip.value2); } _count++; ConsortiaFightData consortiaFightData = new ConsortiaFightData(); consortiaFightData.id = fightCmdSynResp.heroId; consortiaFightData.skillId = fightCmdSynResp.skillId; consortiaFightData.judgeDic = judgeDic; consortiaFightData.mechanicses = fightCmdSynResp.mechanicsList; consortiaFightData.buffList = fightCmdSynResp.newBuffList; consortiaFightData.delBuffList = fightCmdSynResp.delBuffList; consortiaFightData.deadHeroList = fightCmdSynResp.diedHeroList; FightProxy.instance.AddConsortiaFightData(consortiaFightData); foreach (var item in consortiaFightData.mechanicses) { foreach (var g in item.gethits) { Debugger.Log("damaged----------------character {0} hurted {1} remainHp {2}", g.heroId, g.hurt, g.remainHp); } } foreach (var did in consortiaFightData.deadHeroList) { Debugger.Log("dead----------------character {0} skillId {1} deadid {2}", fightCmdSynResp.heroId, fightCmdSynResp.skillId, did); } DataMessageHandler.DataMessage_OrderConsortiaSkill((uint)fightCmdSynResp.heroId, (uint)fightCmdSynResp.skillId, fightCmdSynResp.releaseTime, false); } Debugger.LogError("server skill count:{0}", _count); FightController.instance.PreReadyFight(); return(true); }
private void InitSkill() { TransformUtil.ClearChildren(skillRootTran, true); _skillItemList.Clear(); List <HeroEntity> heros = new List <HeroEntity>(PlayerController.instance.heros); if (heros.Count == 0) { return; } HeroEntity character = heros[0]; _character = character; RoleInfo role = null; if (character is PlayerEntity) { role = PlayerController.instance.GetPlayerInfo(); } else if (character is HeroEntity) { role = PlayerController.instance.GetHeroInfo(character.characterInfo.instanceID); } else { Debugger.LogError("these is not this type: " + character.GetType()); } if (character.characterInfo.skillInfo1 != null) { IllustrationSkillItemButton btn = Instantiate <IllustrationSkillItemButton>(skillItemBtnPrefab); btn.transform.SetParent(skillRootTran, false); btn.gameObject.SetActive(true); btn.SetData((int)character.characterInfo.instanceID, character.characterInfo.skillInfo1); _skillItemList.Add(btn); } if (character.characterInfo.skillInfo2 != null) { IllustrationSkillItemButton btn = Instantiate <IllustrationSkillItemButton>(skillItemBtnPrefab); btn.transform.SetParent(skillRootTran, false); btn.gameObject.SetActive(true); btn.SetData((int)character.characterInfo.instanceID, character.characterInfo.skillInfo2); _skillItemList.Add(btn); } // if (character.characterInfo.aeonSkillInfo != null) // { // IllustrationSkillItemButton btn = Instantiate<IllustrationSkillItemButton>(skillItemBtnPrefab); // btn.transform.SetParent(skillRootTran, false); // btn.gameObject.SetActive(true); // btn.SetData((int)character.characterInfo.instanceID, character.characterInfo.aeonSkillInfo); // _skillItemList.Add(btn); // } }
public void CreateBattle(BattleData data) { Debugger.Log("创建战场:" + data.mBattleKey); if (m_BattleViewDic.ContainsKey(data.mBattleKey)) { Debugger.LogError("Has exist battle with key:" + data.mBattleKey); return; } m_BattleViewDic.Add(data.mBattleKey, new BattleView()); m_BattleViewDic[data.mBattleKey].Init(data); m_BattleViewDic[data.mBattleKey].SyncFrame(data); }
public AssetBundle LoadAssetBundle(string path) { AssetBundle bundle = null; bundle = AssetBundle.LoadFromFile(path); if (bundle == null) { Debugger.LogError(string.Format("Loading Asset Bundle Error: {0}", path)); } return(bundle); }
static UIWindow OpenWindow(string winName, params object[] pars) { Type type = Type.GetType(winName); if (type == null) { Debugger.LogError("Open : " + winName + " window fail, the class " + winName + " don't exist!"); return(null); } return(OpenWindow(type, pars)); }
/// <summary> /// 路径对应的AssetBundle包名 /// </summary> private string PathToBundle(string path) { if (mPathBundleDict.ContainsKey(path)) { return(mPathBundleDict[path]); } else { Debugger.LogError("{0} not exist AssetBundleName!", path); return(string.Empty); } }
public static TDItem GetData(string key) { if (m_DataCache.ContainsKey(key)) { return m_DataCache[key]; } else { Debugger.LogError(string.Format("Can't find key {0} in TDItem", key)); return null; } }
private object FuncInvoke(object func, params object[] args) { try { return(m_FuncInvoke(func, args)); } catch (LuaException le) { Debugger.LogError(le); return(null); } }
public static bool CreateDirectory(string path) { bool result = true; try { System.IO.Directory.CreateDirectory(path); } catch (Exception exp) { Debugger.LogError(string.Format("create directory fail {0}", exp.ToString())); result = false; } return(result); }
/// <summary> /// Gets the planet by its ID. /// </summary> /// <returns>A planet, based on its ID.</returns> /// <param name="planetID">The planet ID to use.</param> public PlanetData GetPlanetByID(int planetID) { if (planetID < solarSystem.Count) { return(solarSystem [planetID]); } else { Debugger.LogError(planetID + " does not match up with any planet!", "SolarData.GetPlanetByID()"); return(null); } }
public static Transform FindChild(Component parentComp, string path) { Transform child = parentComp.GetTrans().Find(path); if (child) { return(child); } Debugger.LogError("Child with path [" + path + "] is not exist!", parentComp); return(null); }
private void GetRandomGiftRewardByProtocol(List <GameResData> dataList) { Refresh(); if (dataList.Count != 0) { Logic.UI.Tips.View.CommonRewardAutoDestroyTipsView.Open(dataList); } else { Debugger.LogError("礼包内奖励数量为0"); } }
public LuaFunction GetLuaFunction(string name) { LuaFunction luaFunc = LuaState.GetFunction(name); if (luaFunc == null) { Debugger.LogError("Call lua function error! name==" + name); return(null); } return(luaFunc); }
public static UnityEngine.Object Load(string path, Type type) { UnityEngine.Object obj = Resources.Load(path, type); if (!obj) { Debugger.LogError(string.Format("Resource load fail, {0} does not exists!!!", path)); return(null); } return(obj); }
IEnumerator OnLoadAssetBundle(string abName, Type type) { string url = m_BaseDownloadingURL + abName; WWW download = null; if (type == typeof(AssetBundleManifest)) { download = new WWW(url); } else { string[] dependencies = m_AssetBundleManifest.GetAllDependencies(abName); if (dependencies.Length > 0) { m_Dependencies.Add(abName, dependencies); for (int i = 0; i < dependencies.Length; i++) { string depName = dependencies[i]; AssetBundleInfo bundleInfo = null; if (m_LoadedAssetBundles.TryGetValue(depName, out bundleInfo)) { bundleInfo.m_ReferencedCount++; } else if (!m_LoadRequests.ContainsKey(depName)) { //LoadAssetRequest request = new LoadAssetRequest(); //List<LoadAssetRequest> requests = null; //{ // requests = new List<LoadAssetRequest>(); // requests.Add(request); // m_LoadRequests.Add(depName, requests); //} yield return(StartCoroutine(OnLoadAssetBundle(depName, type))); } } } download = WWW.LoadFromCacheOrDownload(url, m_AssetBundleManifest.GetAssetBundleHash(abName), 0); } yield return(download); if (!string.IsNullOrEmpty(download.error)) { Debugger.LogError("WWW load Asset Error for: " + download.error); yield break; } //fix bug: cards.unity if (GetLoadedAssetBundle(abName) == null) { AssetBundle assetObj = download.assetBundle; AddLoadedAssetBundle(abName, assetObj); } }
public bool Handle(MemoryStream stream) { int totalMsgLen = (int)stream.Length; if (totalMsgLen < 2) { Debugger.LogError("Invalid msg[len=" + Convert.ToString(totalMsgLen) + "]"); return(false); } stream.Read(_tempBuf, 0, 2); ushort lenth = BitConverter.ToUInt16(_tempBuf, 0); if (lenth != totalMsgLen) { Debugger.LogError("msg lenth different"); return(false); } _tempStream.Position = 0; _tempStream.SetLength(0); _tempStream.Write(stream.GetBuffer(), 2, totalMsgLen - 2); _tempStream.Position = 0; _tempBuf = _tempStream.GetBuffer(); Rc4.rc4_go(ref _tempBuf, _tempBuf, totalMsgLen - 2, _rc4Key, _rc4Key.Length, 1); _deserializeStream.Position = 0; _deserializeStream.SetLength(0); _deserializeStream.Write(_tempBuf, 0, totalMsgLen - 2); _deserializeStream.Position = 0; try { PacketHeader head = PacketHeader.Parser.ParseFrom(_deserializeStream); if (UnityDefine.UnityEditor) { Debugger.Log("Rcv msg id1:" + head.Id1 + " id2:" + head.Id2); } _deserializeStream.Position = 0; _msgDispatcher.Dispatch(head, _deserializeStream); } catch (Exception ex) { Debugger.LogError("Invalid msg"); Debugger.LogException(ex); return(false); } return(true); }
//接收数据处理 public void OnDataReceived(object sender, DataEventArgs e) { int m_CurPos = 0; while (m_RecvPos - m_CurPos >= 8) { int len = BitConverter.ToInt32(m_RecvBuffer, m_CurPos); int type = BitConverter.ToInt32(m_RecvBuffer, m_CurPos + 4); if (len > m_RecvBuffer.Length) { Debugger.LogError("can't pause message" + "type=" + type + "len=" + len); break; } if (len > m_RecvPos - m_CurPos) { break;//wait net recv more buffer to parse. } //获取stream System.IO.MemoryStream tempStream = null; if (mReceiveStreamsPool.Count > 0) { tempStream = mReceiveStreamsPool[0]; tempStream.SetLength(0); tempStream.Position = 0; mReceiveStreamsPool.RemoveAt(0); } else { tempStream = new System.IO.MemoryStream(); } //往stream填充网络数据 tempStream.Write(m_RecvBuffer, m_CurPos + 8, len - 8); tempStream.Position = 0; m_CurPos += len; mReceiveMsgIDs.Add(type); mReceiveStreams.Add(tempStream); } if (m_CurPos > 0) { m_RecvPos = m_RecvPos - m_CurPos; if (m_RecvPos < 0) { Debug.LogError("m_RecvPos < 0"); } if (m_RecvPos > 0) { Buffer.BlockCopy(m_RecvBuffer, m_CurPos, m_RecvBuffer, 0, m_RecvPos); } } }
public LuaTable DoFile(string luaPath) { try { Debugger.Log("DoFile: " + luaPath); return(m_DoFile(luaPath)); } catch (LuaException le) { Debugger.LogError(le); return(null); } }
/// <summary> /// 清理Lua的容器引用 /// </summary> public void ClearLuaRef() { //Debug.Log("ClearLuaRef..."); var luaFun = _luaRoleMgr.GetLuaFunction("ClearList"); if (luaFun == null) { Debugger.LogError("找不到ClearList"); return; } luaFun.Call(); }
public void OnResetItemHandler(GameObject go, int index) { FriendButton fb = go.GetComponent <FriendButton>(); if (index < _currentFriendList.Count) { fb.SetFriendInfo(_currentFriendList[index], _currentToggleId); } else { Debugger.LogError("index out of range ,index" + index + ",count:" + _currentFriendList.Count); } }
// Use this for initialization void Start() { DontDestroyOnLoad(this.gameObject); _luaState = LuaClient.GetMainState(); _luaRoleMgr = _luaState.GetTable("RoleMgr"); _luaState.translator.LogGC = true; if (_luaRoleMgr == null) { Debugger.LogError("找不到RoleMgr"); return; } CreateGameObject(); }
public static Delegate CreateDelegate(Type t, LuaFunction func) { DelegateFactory.DelegateValue delegateValue = null; if (!DelegateFactory.dict.TryGetValue(t, out delegateValue)) { Debugger.LogError("Delegate {0} not register", new object[] { t.FullName }); return(null); } return(delegateValue(func)); }
public static void QuickShowHide() { Transform[] trans = Selection.transforms; if (trans.Length == 0) { Debugger.LogError("u select nothing !!"); return; } foreach (Transform father in trans) { father.gameObject.SetActive(!father.gameObject.activeSelf); } }
public object FuncInvoke(LuaTable table, string path, params object[] args) { if (table != null) { object func = table.GetInPath <object>(path); return(FuncInvoke(func, args)); } else { Debugger.LogError("FuncInvoke: table is null!"); return(null); } }
public static bool AttachEffect(GameObject obj, GameObject effectObject, string attachJoint) { Transform attachTransform = SearchChildByName(obj.transform, attachJoint); if (attachTransform == null) { Debugger.LogError("attach joint " + attachJoint + " doesn't exist in this gameobject " + obj.name); return(false); } effectObject.transform.SetParent(attachTransform, false); return(true); }
public static TextAsset LoadLuaBundle(string path, string assetName) { AssetBundle assetBundle = AssetBundle.LoadFromFile(path); if (assetBundle) { TextAsset asset = assetBundle.LoadAsset <TextAsset>(assetName); assetBundle.Unload(false); return(asset); } Debugger.LogError("<b>AssetBundl.Load lua failed:</b> " + path); return(null); }
public static PassiveData GetPassiveDataById(uint id) { if (_passiveDataDic == null) { GetPassiveDatas(); } if (_passiveDataDic.ContainsKey(id)) { return(_passiveDataDic[id]); } Debugger.LogError("can't find PassiveData id:" + id); return(null); }
public LuaFunction LoadFile(string luaPath) { try { Debugger.Log("LoadFile: " + luaPath); return(m_LoadFile(luaPath)); } catch (LuaException le) { Debugger.LogError(le); return(null); } }