public int HandlePacket(GameClient client, GSPacketIn packet) { int id = packet.ReadInt(); if (client.Player.PlayerCharacter.AnswerSite < id) { List <ItemInfo> infos = null; if (DropInventory.AnswerDrop(id, ref infos) == true) { client.Player.PlayerCharacter.AnswerSite = id; if (infos != null) { int gold = 0; int money = 0; int giftToken = 0; foreach (ItemInfo info in infos) { ItemInfo.FindSpecialItemInfo(info, ref gold, ref money, ref giftToken); if (info != null) { if (info.Template.BagType == eBageType.PropBag) { client.Player.MainBag.AddTemplate(info, info.Count); } } client.Player.AddGold(gold); client.Player.AddMoney(money); client.Player.AddGiftToken(giftToken); LogMgr.LogMoneyAdd(LogMoneyType.Award, LogMoneyType.Award_Answer, client.Player.PlayerCharacter.ID, money, client.Player.PlayerCharacter.Money, gold, 0, 0, "", "", ""); } } } } //GSPacketIn pkg = packet.Clone(); //pkg.ClearContext(); //pkg.WriteByte(0); ////pkg.WriteInt(0); //for (int i = 0; i < 100; i++) //{ // pkg.WriteByte(1); //} //pkg.WriteInt(client.Player.PlayerCharacter.AnswerSite); //client.Player.Out.SendTCP(pkg); return(1); }
void OnDestroy() { this._tryCall(MainLoopEvent.OnDestroy); #if UNITY_5_5 || UNITY_5_4 || UNITY_5_6 SceneManager.sceneLoaded -= this.OnSceneLoad; #endif if (FrameWorkConfig.Open_DEBUG) { if (this.methodDic != null) { var en = methodDic.GetEnumerator(); while (en.MoveNext()) { en.Current.Value.Dump((MainLoopEvent)en.Current.Key); } } if (this.attEvents != null) { var en = attEvents.GetEnumerator(); while (en.MoveNext()) { en.Current.Value.Dump((MainLoopEvent)en.Current.Key); } } if (this.eventList != null) { var en = eventList.GetEnumerator(); while (en.MoveNext()) { Action <int> act = en.Current.Value; if (act != null) { Delegate d = act as Delegate; Delegate[] delegates = d.GetInvocationList(); for (int i = 0; i < delegates.Length; ++i) { LogMgr.LogWarningFormat(" eventList {0} in {1} not clear at:{2}", delegates[i].Method.Name, delegates[i].Method.DeclaringType, (MainLoopEvent)en.Current.Key); } } } } } }
private static void LeavedScene(int level) { try { if (!GameSceneCtr.mIns.CurScene.IsValid()) { return; } LogMgr.LogFormat("场景离开 {0} ", GameSceneCtr.mIns.CurScene.name); if (SceneOpDic != null && SceneOpDic.ContainsKey(GameSceneCtr.mIns.CurScene.buildIndex)) { Dictionary <int, List <FieldInfo> > dic = SceneOpDic[GameSceneCtr.mIns.CurScene.buildIndex]; if (dic.ContainsKey(1)) { List <FieldInfo> list = dic[1]; for (int i = 0; i < list.Count; ++i) { FieldInfo f = list[i]; #if UNITY_EDITOR if (f.GetValue(null) != null && f.IsStatic) { if (FrameWorkConfig.Open_DEBUG) { LogMgr.LogFormat("====> {0} 对象置空", f.FieldType); } f.SetValue(null, null); } else { LogMgr.Log("对象从未实例化过或者为非静态字段 => " + f.Name); } #else f.SetValue(null, null); #endif } } } } catch (Exception ex) { LogMgr.LogException(ex); } }
// 做 Post 上去的動作 public static void PostHttp(string strURL, string strMethodName, Dictionary <string, object> dictArgs, CompleteCallback callback, object UserState = null) { // 單機版的寫法 #if NOT_NETWORK LogMgr.DebugLog("[WebPost][PostHttp][LocalHost] MethodName:{0}, Args:{1}", strMethodName, JsonConvert.SerializeObject(dictArgs)); GameServer.instance().Receive(strMethodName, dictArgs, callback, UserState); #else LogMgr.DebugLog("[WebPost][PostHttp] MethodName:{0}, Args:{1}", strMethodName, JsonConvert.SerializeObject(dictArgs)); // 連線網址 string strConnectURL = string.Format("{0}/{1}", strURL, strMethodName); Dictionary <string, object> dictResult = new Dictionary <string, object>(); dictResult["strJson"] = JsonConvert.SerializeObject(dictArgs); // 參數內容 string strContent = JsonConvert.SerializeObject(dictResult); // 呼叫做處理 _PostHttp(strConnectURL, strContent, callback, UserState); #endif }
private void FinishCopy() { mFinishCopyNum++; mParent.UpdateProgress("正从本地解压缩资源(此过程不消耗流量)", mFinishCopyNum * 1.0f / mTotalCopyNum); mCurCopyNum--; CopyAsset(); if (mCurCopyNum == 0 && mStreamFiles.Count == 0) { mParent.UpdateProgress("正从本地解压缩资源(此过程不消耗流量)", 1f); if (null != mFinishCallback) { LogMgr.UnityError(Time.realtimeSinceStartup.ToString()); mFinishCallback(); } } }
/// <summary> /// 시리얼 포트 닫기 /// </summary> /// <returns>시리얼 포트가 닫혔는지 유무</returns> public bool Close() { bool bIsClosed = false; if (mSerialPort.IsOpen) { mSerialPort.Close(); bIsClosed = !mSerialPort.IsOpen; LogMgr.WriteLog(LogMgr.LogType.COM, string.Format("{0}({1}) - {2}", SerialName, mSerialPort.PortName, mSerialPort.IsOpen ? "Close" : "Close Failed")); } else { bIsClosed = true; } return(bIsClosed); }
void TryLoadAsset() { if (File.Exists(toolasset)) { asset = AssetDatabase.LoadAssetAtPath <MenuToolsAsset>(baseassetpath); if (asset == null) { LogMgr.LogError("asset is Null"); } } else { asset = ScriptableObject.CreateInstance <MenuToolsAsset>(); AssetDatabase.CreateAsset(asset, baseassetpath); } RefreshAsset(); }
public bool ReadLedDotValString(int iAddr, ref string strVals) { try { ClearOldReadBuf(); bool bError = false; byte[] bBuf = GLLedProtocol.MakeCmdLedGetDecimal(iAddr); Write(bBuf, 0, bBuf.Length); Thread.Sleep(100); byte[] bRead = Read(out bError); return(GLLedProtocol.AnalyeseRecGetDecmailString(bRead, ref strVals)); } catch (System.Exception ex) { LogMgr.WriteInfoDefSys("读写异常" + ex.Message); return(false); } }
private static void _ConfirmFrameDone(System.Object o, int value) { if (o is WaitTaskCommand) { WaitTaskCommand cmd = o as WaitTaskCommand; if ((cmd.m_task == null || !cmd.m_task.KeepWaiting) && cmd.RunningState != CommandState.Paused) { //if(FrameWorkConfig.Open_DEBUG) // LogMgr.LogFormat("{0} ID:{1} finished . ::::Task :{2}",cmd,cmd.UID,cmd.m_task); cmd.End(); } } else { LogMgr.LogError(o); } }
public static List <OrgInfo> GetAllOrgInfo() { try { using (GLedDbEntities ent = new GLedDbEntities()) { List <OrgInfo> pros = (from c in ent.OrgInfo select c).ToList <OrgInfo>(); return(pros); } } catch (Exception ex) { LogMgr.WriteErrorDefSys("GetAllCardInfo error " + ex.Message); throw; } }
private object DeserializeFieldFromXMLType(XmlElement xmlElement, Type type, object obj = null) { string fieldName = xmlElement.GetAttribute("name"); FieldInfo field = type.GetField(fieldName); if (field == null) { LogMgr.LogWarning("Failed to find field " + fieldName + " on type " + type.Name); return(null); } object fieldValue = DeserializeObjectFromXML(xmlElement, field.FieldType, false); if (obj != null) { field.SetValue(obj, fieldValue); } return(fieldValue); }
public virtual void Cancel() { if (this._state == CommandState.Running) { this._state = CommandState.Canceled; if (FrameWorkConfig.Open_DEBUG) { LogMgr.LogFormat("********* Cmd Cancel :{0}", this); } RunningList.Remove(this); if (AutoPoolManger) { this.Release(true); } } }
public void Recorde(string path) { if (_recordeBundle) { //#if UNITY_EDITOR lock (_lockObj) { string file = path.Replace(Util.DataPath, "").Replace(Util.AppContentPath(), ""); LogMgr.Log("RecordeBundle:" + file); if (!_bundles.Contains(file)) { _bundles.Add(file); _subBundles.Enqueue(file); } } //#endif } }
/// <summary> /// 获取全部数据 /// </summary> /// <returns></returns> public override List <ControlEnum> GetList() { string query = @"select control.ControlType,controlEnum.ControlEnumId,controlEnum.EnumName" + " from control inner join controlEnum on control.ControlId=controlEnum.ControlId "; try { using (Conn) { return(Conn.Query <ControlEnum>(query).ToList()); } } catch (Exception ex) { LogMgr.WriteLog("ControlEnumNameDll.GetList." + "获取数据:" + ex.Message); } return(null); }
public void Put(string name, Transform trm) { LogMgr.I("GoPoolMgr", "Put", "poolName:" + name + " trmName:" + trm.name, BeShowLog); trm.SetParent(transform); if (trm.gameObject.activeSelf) { trm.gameObject.SetActive(false); } if (!poolGoDic.ContainsKey(name)) { poolGoDic.Add(name, new List <Transform>()); } poolGoDic [name].Add(trm); }
public Object LoadAssetAsync(string assetName, Type type) { if (this.assetBundle) { Object request = null; if (!this.m_CacheLoadedAssets.TryGetValue(assetName, out request)) { request = this.assetBundle.LoadAsset(assetName, type); this.m_CacheLoadedAssets.Add(assetName, request); } return(request); } else { LogMgr.LogWarning(assetName + "has not loaded"); return(null); } }
public void UnLoad(bool all) { if (this.Res != null && this.DependCount == 0) { if (!all && GameSyncCtr.mIns.FrameWorkTime - this.CreateTime < deltatime) { LogMgr.LogErrorFormat("Reject the {0} Asset {1} Desotry ", this.name, all); return; } LogMgr.LogErrorFormat("{0} Asset Will {1} Desotry ", this.name, all); //if (FrameWorkConfig.Open_DEBUG) ResBundleMgr.mIns.Cache.Remove(this.filename); this.Res.Unload(all); this.Dispose(); } }
/// <summary> /// 以主键获取数据 /// </summary> /// <param name="id"></param> /// <returns></returns> public override ControlEnum GetEntity(int id) { string query = @"select control.ControlType,controlEnum.ControlEnumId,controlEnum.EnumName" + "from control inner join controlEnum on control.ControlId=controlEnum.ControlId where ControlEnumId = @ControlEnumId"; try { using (Conn) { return(Conn.Query <ControlEnum>(query, new { ControlEnumId = id }).SingleOrDefault()); } } catch (Exception ex) { LogMgr.WriteLog("ControlEnumNameDll.GetEntity." + id.ToString() + ":获取数据:" + ex.Message); } return(null); }
/// <summary> /// Restores the clips removed in BeginNoClip or MoveClipsUp /// </summary> public static void RestoreClips() { if (rectStackGroups.Count == 0) { LogMgr.LogError("GUIClipHierarchy: BeginNoClip/MoveClipsUp - RestoreClips count not balanced!"); return; } // Read and restore clips one by one, from top to bottom List <Rect> rectStackGroup = rectStackGroups[rectStackGroups.Count - 1]; for (int clipCnt = 0; clipCnt < rectStackGroup.Count; clipCnt++) { GUI.BeginClip(rectStackGroup[clipCnt]); currentRectStack.RemoveAt(currentRectStack.Count - 1); } rectStackGroups.RemoveAt(rectStackGroups.Count - 1); }
public static OrgInfo GetAOrgById(int id) { try { using (GLedDbEntities ent = new GLedDbEntities()) { OrgInfo pro = (from c in ent.OrgInfo where c.Id == id select c).FirstOrDefault(); return(pro); } } catch (Exception ex) { LogMgr.WriteErrorDefSys("GetAllCardInfo error " + ex.Message); throw; } }
/// <summary> /// Debugs the values of all possible output nodes /// Could be done more precisely but it atleast shows how to get them /// </summary> private void DebugOutputResults() { AssureCanvas(); LogMgr.Log("Calculating '" + canvas.saveName + "':"); List <Node> outputNodes = getOutputNodes(); foreach (Node outputNode in outputNodes) { // Display value of all output nodes string outValueLog = "(OUT) " + outputNode.name + ": "; // Use knob values - either output knobs, or input knobs if there are now output knobs List <ConnectionKnob> sourceValueKnobs = outputNode.outputKnobs.Count == 0? outputNode.inputKnobs : outputNode.outputKnobs; foreach (ValueConnectionKnob knob in sourceValueKnobs.OfType <ValueConnectionKnob> ()) { outValueLog += knob.styleID + " " + knob.name + " = " + (knob.IsValueNull? "NULL" : knob.GetValue().ToString()) + "; "; } LogMgr.Log(outValueLog); } }
void OnGUI() { try { GUI.skin.label.normal.textColor = Color.black; int old = GUI.skin.label.fontSize; GUI.skin.label.fontSize = 30; GUI.Label(new Rect(Screen.width - 150, 0, 150, 60), string.Format("{0:F2} FPS", GameSyncCtr.mIns.Fps)); GUI.skin.label.fontSize = old; } catch (Exception ex) { LogMgr.LogException(ex); this.enabled = false; } }
/// <summary> /// 比较沙盒与远程resVer /// </summary> private void CompareResVerPersist_Remote() { int result = VersionUtils.CompareVersion(UpdateMgr.PersistentResVer, UpdateMgr.RemoteResVer); switch (result) { case 0: //相同,不需要更新 case -1: //persistentResVer大,理论上不应该存在本地比server大的情况 LogMgr.I("DownloadRes", "CompareResVerPersist_Remote", "比较resVer persist:" + UpdateMgr.PersistentResVer + " remoteResVer" + UpdateMgr.RemoteResVer + " 不需要下载,准备进入复制流程", BeShowLog); SetState(DownloadResState.downloadComplete); break; case 1: //RemoteResVer,准备更新流程 LogMgr.I("DownloadRes", "CompareResVerPersist_Remote", "比较resVer persist:" + UpdateMgr.PersistentResVer + " remoteResVer" + UpdateMgr.RemoteResVer + " 需要下载,准备拉取remote resInfoList", BeShowLog); SetState(DownloadResState.pullRemoteResInfoList); break; } }
bool SaveClient(MultiFileOK dd) { //验证crc DownResData drd = dd.Drd; if (drd.ResSize != dd.Data.Length) { LogMgr.Log("Client:" + drd.ResType + "大小不匹配,localSize:" + dd.Data.Length + ", serverSize:" + drd.ResSize); return(false); } uint crc = Crc.Crc32(dd.Data, 0, dd.Data.Length); if (crc != drd.ResCrc) { LogMgr.Log("Client:" + drd.ResType + "资源检验失败, size:" + dd.Data.Length + ", localCrc:" + crc + ", serverCrc:" + drd.ResCrc); return(false); } if (RuntimeInfo.GetPlatform() == GamePlatformType.Windows) { SaveWindowClientRes(dd.Data); return(true); } string path = GetClientPath(); try { File.Delete(path); } catch { } FileStream fs = File.Create(path); if (fs == null) { LogMgr.Log("Client文件创建失败:" + drd.ResType); return(false); } fs.Write(dd.Data, 0, dd.Data.Length); fs.Flush(); fs.Close(); return(true); }
public void GlobalInit() { if (IS_DISABLED_SDK) { IS_SDK_CHANNEL = false; SDK_TYPE = SdkType.SDK_SELF; PACKAGE_NAME = "com.leduo.buyu.self"; byte[] data2 = System.Text.Encoding.ASCII.GetBytes(PACKAGE_NAME); PACKAGE_NAME_CRC = Crc.Crc32(data2, 0, data2.Length); m_Interface = null; m_Interface = new SDKBaseNoSDK(); return; } IS_SDK_CHANNEL = SDK_TYPE == SdkType.SDK_CHANNEL; if (IS_SDK_CHANNEL) { m_Interface = new SDKChannel(); m_SceneCallbackObj = new GameObject(); m_SceneCallbackObj.name = "SDKCallbackObj"; m_SceneCallback = m_SceneCallbackObj.AddComponent <SDKSceneCallback>(); } else { if (SDK_TYPE == SdkType.SDK_DERIVED) { m_Interface = new SDKDerived(); } else { m_Interface = new SDKBase(); } } PACKAGE_NAME = NativeInterface.GetPackageName(); byte[] data = System.Text.Encoding.ASCII.GetBytes(PACKAGE_NAME); PACKAGE_NAME_CRC = Crc.Crc32(data, 0, data.Length); //SDK初始化 #if UNITY_IOS IS_APP_STORE_VER = NativeInterface.IsAppStoreVer(); #endif LogMgr.Log("包名:" + PACKAGE_NAME + "|类型:" + SDK_TYPE + "|官网:" + IsOfficialVersion); m_LoginData.Result = LoginState.LOGIN_NONE; m_Interface.GlobalInit(); }
public int HandlePacket(GameClient client, GSPacketIn packet) { byte b = packet.ReadByte(); int num = packet.ReadInt(); bool flag = false; if (b == 1) { flag = packet.ReadBoolean(); } if (b == 1) { List <ItemInfo> list = null; if (DropInventory.AnswerDrop(num, ref list)) { int value = 0; int num2 = 0; int num3 = 0; int num4 = 0; foreach (ItemInfo current in list) { ItemInfo.FindSpecialItemInfo(current, ref value, ref num2, ref num3, ref num4); if (current != null && current.Template.BagType == eBageType.PropBag) { client.Player.MainBag.AddTemplate(current, current.Count); } client.Player.AddGold(value); client.Player.AddMoney(num2); client.Player.AddGiftToken(num3); LogMgr.LogMoneyAdd(LogMoneyType.Award, LogMoneyType.Award_Answer, client.Player.PlayerCharacter.ID, num3, client.Player.PlayerCharacter.Money, num2, 0, 0, 0, "", "", ""); } } if (flag) { client.Player.PlayerCharacter.openFunction((Step)num); } } if (b == 2) { client.Player.PlayerCharacter.openFunction((Step)num); } client.Player.UpdateAnswerSite(num); return(1); }
public void RegisterLogicFunc(MethodInfo method, int CMD, string MethodName, object attvalue, ScriptTarget target) { if (ScriptDic.ContainsKey(CMD)) { SimpleDictionary <int, ScriptPkg> dic = this.ScriptDic[CMD]; if (dic.ContainsKey((int)target)) { LogMgr.LogErrorFormat("重复注册逻辑函数 {0}", CMD); } else { if (target == ScriptTarget.Sharp) { dic[(int)target] = ScriptPkg.CreateSharp(method, MethodName); } else if (target == ScriptTarget.Lua) { #if TOLUA dic[(int)target] = ScriptPkg.CreateLua(attvalue); #else throw new FrameWorkException("Missing Lua"); #endif } } } else { SimpleDictionary <int, ScriptPkg> dic = new SimpleDictionary <int, ScriptPkg>(); if (target == ScriptTarget.Sharp) { dic[(int)target] = ScriptPkg.CreateSharp(method, MethodName); } else if (target == ScriptTarget.Lua) { #if TOLUA dic[(int)target] = ScriptPkg.CreateLua(attvalue); #else LogMgr.LogError("Missing Lua"); #endif } this.ScriptDic.Add(CMD, dic); } }
/// <summary> /// Gets the ConnectionPortStyle for the specified style name or creates it if not defined /// </summary> public static ConnectionPortStyle GetPortStyle(string styleName, Type baseStyleClass = null) { if (connectionPortStyles == null || connectionPortStyles.Count == 0) { FetchConnectionPortStyles(); } if (baseStyleClass == null || !typeof(ConnectionPortStyle).IsAssignableFrom(typeof(ConnectionPortStyle))) { baseStyleClass = typeof(ConnectionPortStyle); } ConnectionPortStyle portStyle; if (!connectionPortStyles.TryGetValue(styleName, out portStyle)) { // No port style with the exact name exists if (typeof(ValueConnectionType).IsAssignableFrom(baseStyleClass)) { // A ValueConnectionType is searched, try by type name Type type = Type.GetType(styleName); if (type == null) // No type matching the name found either { LogMgr.LogError("No ValueConnectionType could be found or created with name '" + styleName + "'!"); return(null); } else // Matching type found, search or create type data based on type { portStyle = GetValueConnectionType(type); } } else { portStyle = (ConnectionPortStyle)Activator.CreateInstance(baseStyleClass, styleName); connectionPortStyles.Add(styleName, portStyle); LogMgr.LogWarning("Created style from name " + styleName + "!"); } } if (!baseStyleClass.IsAssignableFrom(portStyle.GetType())) { throw new Exception("Cannot use Connection Style: '" + styleName + "' is not of type " + baseStyleClass.Name + "!"); } if (!portStyle.isValid()) { LogMgr.LogError("Fetched style " + portStyle.Identifier + " is invalid!"); } return(portStyle); }
public bool BeginLoadRes(ResType dir, bool bManager) { //#if UNITY_EDITOR if (ENABLE_RESOURCES) { return(true); } //#endif m_bLoadedRes = true; int idx = (int)dir; if (m_AssetList[idx] != null) { return(true); } m_AssetManager[idx] = bManager; string path; path = RuntimeInfo.GetResPersistentPath(dir); #if UNITY_EDITOR if (!File.Exists(path)) { return(true); } #endif m_AssetList[idx] = AssetBundle.LoadFromFile(path); if (m_AssetList[idx] == null) { #if UNITY_EDITOR return(true); #endif LogMgr.Log("Asset not found:" + path + "exists:" + File.Exists(path)); } if (m_AssetList[idx] != null) { return(true); } else { return(false); } }
IEnumerator IEStartGPS() { // Input.location 用于访问设备的位置属性(手持设备), 静态的LocationService位置 // LocationService.isEnabledByUser 用户设置里的定位服务是否启用 if (!Input.location.isEnabledByUser) { this.gps_info = "isEnabledByUser value is:" + Input.location.isEnabledByUser.ToString() + " Please turn on the GPS"; LogMgr.D(this.gps_info); yield return(false); } // LocationService.Start() 启动位置服务的更新,最后一个位置坐标会被使用 Input.location.Start(10.0f, 10.0f); int maxWait = 20; while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0) { // 暂停协同程序的执行(1秒) yield return(new WaitForSeconds(1)); maxWait--; } if (maxWait < 1) { this.gps_info = "Init GPS service time out"; LogMgr.D(this.gps_info); yield return(false); } if (Input.location.status == LocationServiceStatus.Failed) { this.gps_info = "Unable to determine device location"; LogMgr.D(this.gps_info); yield return(false); } else { this.gps_info = "N:" + Input.location.lastData.latitude + " E:" + Input.location.lastData.longitude; LogMgr.D(this.gps_info); yield return(new WaitForSeconds(100)); } }