public void Initialize(string content) { if (content.IsNullOrWhiteSpace()) { LogCat.LogError("AssetBundleMap empty!!"); return; } fileContent = content; content = content.Replace("\r\n", "\n"); var mapList = content.Split('\n'); for (var i = 0; i < mapList.Length; i++) { var map = mapList[i]; if (map.IsNullOrWhiteSpace()) { continue; } var splits = map.Split(new[] { StringConst.String_Comma }, StringSplitOptions.None); if (splits.Length < 2) { LogCat.LogError("splitArr length < 2 : " + map); continue; } string assetBundleName = splits[0]; long bytes = splits[1].To <long>(); dict[assetBundleName] = bytes; } }
public void Initialize(string content) { if (content.IsNullOrWhiteSpace()) { LogCat.LogError("LuaPathMap empty!!"); return; } fileContent = content; content = content.Replace("\r\n", "\n"); var mapList = content.Split('\n'); for (var i = 0; i < mapList.Length; i++) { var map = mapList[i]; if (map.IsNullOrWhiteSpace()) { continue; } var splits = map.Split(new[] { StringConst.String_Comma }, StringSplitOptions.None); if (splits.Length < 2) { LogCat.LogError("splitArr length < 2 : " + map); continue; } var luaName = splits[0]; var luaPath = splits[1]; luaName2LuaPathDict[luaName] = luaPath; } }
//owner 发放任务的npc public bool AcceptMission(Mission mission, Doer owner) { var orgEnv = mission.GetEnv(); if (orgEnv != null) { LogCat.LogError(string.Format("{0} still belong to {1}", mission, orgEnv)); mission.Destruct(); return(false); } if (IsHasMission(mission.GetId())) { LogCat.LogError(string.Format("duplicate mission id![{0}]", mission)); mission.Destruct(); return(false); } var missions = this.oMissions.GetMissions_ToEdit(); mission.SetEnv(this); mission.SetOwner(owner); missions.Add(mission); if (!mission.OnAccept(this)) { mission.Destruct(); missions.Remove(mission); //失败,减回去 return(false); } // 检测完成任务 this.CheckAutoFinishMissions(); return(true); }
public override bool Write(byte[] buffer, int offset, int length) { if (pos + length > base.length) { if (incLen <= 0) { incLen = 128; LogCat.LogError("KMemoryOutputStream write error with 0 increase length"); } var num = incLen; var num2 = base.length + num; while (pos + length >= num2) { num2 += num; } var dst = new byte[num2]; Buffer.BlockCopy(data, 0, dst, 0, base.length); data = dst; base.length = num2; } Buffer.BlockCopy(buffer, offset, data, pos, length); pos += length; return(true); }
public static Array RemoveAt(Array sourceArray, int index) { var elementType = sourceArray.GetType().GetElementType(); var sourceArrayLength = sourceArray.Length; if (sourceArrayLength == 0) { return(sourceArray); } int toRemoveIndex = index; if (toRemoveIndex < 0 || toRemoveIndex >= sourceArrayLength) { LogCat.LogError("index out of boundary"); return(sourceArray); } var array = Array.CreateInstance(elementType, sourceArrayLength - 1); if (toRemoveIndex != 0) { Array.Copy(sourceArray, 0, array, 0, toRemoveIndex); } if (toRemoveIndex != sourceArrayLength - 1) { Array.Copy(sourceArray, toRemoveIndex + 1, array, toRemoveIndex, sourceArrayLength - toRemoveIndex - 1); } return(array); }
public void Foreach(TKey key, Action <TValue> action, bool isIgnoreValueNull = true) { if (!this.ContainsKey(key)) { return; } List <TValue> valueList = this[key]; if (valueList == null) { return; } for (var i = 0; i < valueList.Count; i++) { TValue value = valueList[i]; if (isIgnoreValueNull && value == null) { continue; } try { action(value); } catch (Exception e) { LogCat.LogError(e); } } CheckAll(); }
public void ForeachKV2OfKey1(TKey1 key1, Action <TKey2, TValue2> action) { if (!this.ContainsKey(key1)) { return; } Dictionary <TKey2, TValue2> dict2 = this[key1]; if (dict2 == null) { return; } foreach (KeyValuePair <TKey2, TValue2> kv2 in dict2) { try { action(kv2.Key, kv2.Value); } catch (Exception e) { LogCat.LogError(e); } } CheckAll(); }
public static object Field(string label, Type type, object fieldValue) { if (type == typeof(string)) { return(EditorGUILayout.TextField(label, (string)fieldValue)); } if (type == typeof(float)) { return(EditorGUILayout.FloatField(label, (float)fieldValue)); } if (type == typeof(int)) { return(EditorGUILayout.IntField(label, (int)fieldValue)); } if (type == typeof(Bounds)) { return(EditorGUILayout.BoundsField(label, (Bounds)fieldValue)); } if (type == typeof(Color)) { return(EditorGUILayout.ColorField(label, (Color)fieldValue)); } if (type == typeof(AnimationCurve)) { return(EditorGUILayout.CurveField(label, (AnimationCurve)fieldValue)); } if (type == typeof(Gradient)) { return(EditorGUILayout.GradientField(label, (Gradient)fieldValue)); } if (type == typeof(long)) { return(EditorGUILayout.LongField(label, (long)fieldValue)); } if (fieldValue is Object o) { using (new EditorGUILayoutBeginHorizontalScope()) { EditorGUILayout.LabelField(label, GUILayout.Width(100)); object result = EditorGUILayout.ObjectField(o, type); return(result); } } if (type == typeof(Rect)) { return(EditorGUILayout.RectField(label, (Rect)fieldValue)); } if (type == typeof(Vector2)) { return(EditorGUILayout.Vector2Field(label, (Vector2)fieldValue)); } if (type == typeof(Vector3)) { return(EditorGUILayout.Vector3Field(label, (Vector3)fieldValue)); } LogCat.LogError(string.Format("不支持该类型的field:{0}", type)); return(null); }
public override void Start() { base.Start(); if ("被动".Equals(this.cfgSpellData.type)) { this.CounterIncrease(); // 被动默认不被消耗 } this.CounterIncrease(); this.targetUnitList = Client.instance.combat.spellManager.RecommendSpellRule(this.sourceUnit, this.targetUnit, this.cfgSpellData, this.originPosition.Value); this.targetUnit = this.targetUnitList.IsNullOrEmpty() ? null : this.targetUnitList[0]; if (this.IsHasMethod("OnStart")) { this.InvokeMethod("OnStart", false); } this.RegisterTriggerSpell(); this.Broadcast <Unit, Unit, SpellBase>(null, SpellEventNameConst.On_Spell_Start, this.sourceUnit, this.targetUnit, this); Client.instance.combat.spellManager.UnRegisterListener("on_start", this.sourceUnit, this, "RegisterTriggerSpell"); if (!this.cfgSpellData.action_name.IsNullOrWhiteSpace()) { // if not self.source_unit.action_dict or // not self.source_unit.action_dict[self.cfgSpellData.action_name] then // Error("action is not find", self.spell_id, self.source_unit.unit_id) // end // self.action = SpellAction.New(self.source_unit.action_dict[self.cfgSpellData.action_name], self.source_unit, self) // self.action:Play() } else { this.PlaySpellAnimation(); if (this.IsHasMethod("OnCast")) { //起手前摇 var castTimePct = this.GetAnimationTimePct(this.cfgSpellData.cast_time, 0); this.RegisterAnimationEvent(castTimePct, "__OnCast"); } //可打断后摇 var breakTimePct = this.GetAnimationTimePct(this.cfgSpellData.break_time, 1); this.RegisterAnimationEvent(breakTimePct , "PassBreakTime"); if ("触发".Equals(this.cfgSpellData.cast_type)) { var castTimePct = this.GetAnimationTimePct(this.cfgSpellData.cast_time, 0); var breakTimePctValue = this.GetAnimationTimePct(this.cfgSpellData.break_time, 1); if (breakTimePctValue < castTimePct) { LogCat.LogError("技能脱手时间比出手时间快"); } this.RegisterAnimationEvent(breakTimePctValue, "OnSpellAnimationFinished"); } } this.CounterDecrease(); }
public void Log(LogCatType logType, string log) { onLogAction?.Invoke(logType, log); if (logType == LogCatType.Error) { LogCat.LogError(log); } }
//物件thing本场景转移到另一场景事件 void DoShift(Thing thing, Vector2Int fromPos, Scene childScene, Vector2Int toPos, int type) { try { OnShift(thing, fromPos, childScene, toPos, type); } catch (Exception exception) { LogCat.LogError(string.Format("env.OnShift error! [{0},{1}->({2}->{3}]:{4}", this, thing, fromPos, toPos, exception)); } }
private void LateUpdate() { if (luaLateUpdate != null) { try { luaLateUpdate(); } catch (Exception ex) { LogCat.LogError(string.Format("luaLateUpdate err : {0}\n{1}", ex.Message, ex.StackTrace)); } } }
private void FixedUpdate() { if (luaFixedUpdate != null) { try { luaFixedUpdate(Time.fixedDeltaTime, Time.fixedUnscaledDeltaTime); } catch (Exception ex) { LogCat.LogError(string.Format("luaFixedUpdate err : {0}\n{1}", ex.Message, ex.StackTrace)); } } }
public static object Deserialize(Hashtable table, object context) { object result = null; try { switch (Convert.ToInt32(table[STR_CLS_TYPE])) { case TYPE_REF: result = JsonSerializer.DeserializeRef(table); break; case TYPE_CLASS: result = JsonSerializer.DeserializeClass(table, context); break; case TYPE_ARRAY: result = JsonSerializer.DeserializeArray(table, context); break; case TYPE_LIST: result = JsonSerializer.DeserializeList(table, context); break; case TYPE_DICT: result = JsonSerializer.DeserializeDict(table, context); break; case TYPE_ENUM: result = JsonSerializer.DeserializeEnum(table); break; case TYPE_VALUE: result = JsonSerializer.DeserializeValue(table); break; default: LogCat.LogError("Deserialize unknown type:" + JsonSerializer.typeCache[Convert.ToInt64(table[STR_CLS_TYPE_ID])]); break; } } catch (Exception ex) { LogCat.LogError("Deserialize failed:" + ex.ToString()); } return(result); }
public static void SafeDoAction(this LuaEnv self, Action action) { if (self == null) { return; } try { action(); } catch (Exception ex) { LogCat.LogError(string.Format("xLua exception : {0}\n {1}", ex.Message, ex.StackTrace)); } }
private IEnumerator IEWaitUtil(Func <bool> func, float timeout = -1) { var time = 0f; while (!func()) { time += Time.deltaTime; if (timeout > 0 && time > timeout) { LogCat.LogError("[Act:When]A WHEN Timeout!!!"); break; } yield return(null); } }
private static void OnUpdate() { foreach (var action in _queue) { try { action?.Invoke(); } catch (Exception e) { LogCat.LogError(e); } } _queue.Clear(); }
private static void ConstructClassTable(Hashtable table) { IDictionaryEnumerator enumerator = table.GetEnumerator(); while (enumerator.MoveNext()) { Type type = Type.GetType(enumerator.Value.ToString()); if (type == null) { LogCat.LogError("type is null:" + enumerator.Value.ToString()); } else { JsonSerializer.typeCache[Convert.ToInt64(enumerator.Key)] = type; } } }
//max_reload_count 失败的重新load的最大次数 public IEnumerator DownloadFileAsync(string downloadURL, string filePath, int maxReloadCount, int curReloadCount = 0) { var resourceWebRequester = DownloadFileAsyncNoCache(downloadURL, filePath); curReloadCount++; yield return(resourceWebRequester); while (curReloadCount < maxReloadCount) { if (!resourceWebRequester.error.IsNullOrWhiteSpace()) { LogCat.LogError(resourceWebRequester.error); resourceWebRequester.Destroy(); PoolCatManagerUtil.Despawn(resourceWebRequester); resourceWebRequester = DownloadFileAsyncNoCache(downloadURL, filePath); yield return(resourceWebRequester); } curReloadCount++; } }
void DoLeave(Thing thing) { try { OnLeave(thing); } catch (Exception exception) { LogCat.LogError(string.Format("to.OnLeave error! [{0}->{1}]:{2}", this, thing, exception)); } try { thing.OnLeaveScene(this); } catch (Exception exception) { LogCat.LogError(string.Format("thing.OnLeaveScene error! [{0}->{1}]:{2}", this, thing, exception)); } }
//owner 发放任务的npc public void GiveUpMission(Mission mission, Doer owner) { if (mission == null) { LogCat.LogError("mission is null"); return; } if (this.GetMission(mission.GetId()) != mission) { LogCat.LogError(string.Format("{0} not belong to {1}", mission, this)); return; } var missions = this.oMissions.GetMissions_ToEdit(); mission.SetEnv(null); mission.SetOwner(owner); missions.Remove(mission); mission.OnGiveUp(this); mission.Destruct(); }
public void Initialize(string content) { if (content.IsNullOrWhiteSpace()) { LogCat.LogError("ResourceNameMap empty!!"); return; } fileContent = content; content = content.Replace("\r\n", "\n"); var mapList = content.Split('\n'); for (var i = 0; i < mapList.Length; i++) { var map = mapList[i]; if (map.IsNullOrWhiteSpace()) { continue; } var splits = map.Split(new[] { StringConst.String_Comma }, StringSplitOptions.None); if (splits.Length < 2) { LogCat.LogError("splitArr length < 2 : " + map); continue; } var item = new AssetPathItem(); // 如:UI/Prefab/Login.assetbundle item.assetBundleName = splits[0]; // 如:Assets/AssetsPackage/UI/Prefab/Login.prefab item.assetPath = splits[1]; assetBundleName2AssetPathListDict.Add(item.assetBundleName, item.assetPath, true); assetPath2AssetBundleNameDict.Add(item.assetPath, item.assetBundleName); } }
//物件thing在本场景中移动事件 void DoMove(Thing thing, Vector2Int fromPos, Vector2Int toPos, List <Vector2Int> trackList, int type) { try { OnMoveThing(thing, fromPos, toPos, trackList, type); } catch (Exception exception) { LogCat.LogError(string.Format("to.OnMoveThing error! [{0},{1}->({2}->{3}]:{4}", this, thing, fromPos, toPos, exception)); } try { thing.OnMove(this, fromPos, toPos, trackList, type); } catch (Exception exception) { LogCat.LogError(string.Format("thing.OnMove error! [{0},{1}->({2}->{3}]:{4}", this, thing, fromPos, toPos, exception)); } }
private void OnResourceWebRequesterDone(ResourceWebRequester resourceWebRequester) { // LogCat.LogError("kkkkkkkkkkkkkkk:"+resourceWebRequester.url); if (!downloadingRequestList.Contains(resourceWebRequester)) { return; } if (!resourceWebRequester.error.IsNullOrWhiteSpace()) { LogCat.LogError("Error when downloading file : " + resourceWebRequester.cache.Get <string>("file_path") + "\n from url : " + resourceWebRequester.url + "\n err : " + resourceWebRequester.error); needDownloadList.Add(resourceWebRequester.cache.Get <string>("file_path")); } else { downloadingRequestList.Remove(resourceWebRequester); needDownloadDict[resourceWebRequester.cache.Get <string>("file_path")]["is_finished"] = true; needDownloadDict[resourceWebRequester.cache.Get <string>("file_path")]["downloded_bytes"] = needDownloadDict[resourceWebRequester.cache.Get <string>("file_path")]["total_bytes"]; var filePath = resourceWebRequester.cache.Get <string>("file_path") .WithRootPath(FilePathConst.PersistentAssetBundleRoot); StdioUtil.WriteFile(filePath, resourceWebRequester.bytes); } resourceWebRequester.Destroy(); PoolCatManagerUtil.Despawn(resourceWebRequester); // LogCat.LogError("ffffffffffffaaaaaaa:"+downloadingRequest.Count); // LogCat.LogError("ffffffffffffbbbbbbb:" + needDownloadList.Count); if (downloadingRequestList.Count == 0 && needDownloadList.Count == 0) { isUpdatingRes = false; } }
public static ShellRequest ProcessCommand(string cmd, string workDirectory = StringConst.String_Empty, List <string> environmentVars = null) { ShellRequest shellRequest = new ShellRequest(); ThreadPool.QueueUserWorkItem(delegate { Process process = null; try { ProcessStartInfo processStartInfo = new ProcessStartInfo(shellApp); #if UNITY_EDITOR_OSX string splitChar = ":"; start.Arguments = "-c"; #elif UNITY_EDITOR_WIN string splitChar = ";"; processStartInfo.Arguments = "/c"; #endif if (environmentVars != null) { foreach (string var in environmentVars) { processStartInfo.EnvironmentVariables["PATH"] += (splitChar + var); } } processStartInfo.Arguments += (" \"" + cmd + " \""); processStartInfo.CreateNoWindow = true; processStartInfo.ErrorDialog = true; processStartInfo.UseShellExecute = false; processStartInfo.WorkingDirectory = workDirectory; if (processStartInfo.UseShellExecute) { processStartInfo.RedirectStandardOutput = false; processStartInfo.RedirectStandardError = false; processStartInfo.RedirectStandardInput = false; } else { processStartInfo.RedirectStandardOutput = true; processStartInfo.RedirectStandardError = true; processStartInfo.RedirectStandardInput = true; processStartInfo.StandardOutputEncoding = Encoding.UTF8; processStartInfo.StandardErrorEncoding = Encoding.UTF8; } process = Process.Start(processStartInfo); process.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs e) { LogCat.LogError(EncodingUtil.GBK2UTF8(e.Data)); }; process.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e) { LogCat.LogError(EncodingUtil.GBK2UTF8(e.Data)); }; process.Exited += delegate(object sender, EventArgs e) { LogCat.LogError(e.ToString()); }; bool is_has_error = false; do { string line = process.StandardOutput.ReadLine(); if (line == null) { break; } line = line.Replace("\\", "/"); _queue.Add(delegate() { shellRequest.Log(0, line); }); } while (true); while (true) { string error = process.StandardError.ReadLine(); if (string.IsNullOrEmpty(error)) { break; } is_has_error = true; _queue.Add(delegate() { shellRequest.Log(LogCatType.Error, error); }); } process.Close(); if (is_has_error) { _queue.Add(delegate() { shellRequest.Error(); }); } else { _queue.Add(delegate() { shellRequest.NotifyDone(); }); } } catch (Exception e) { LogCat.LogError(e); process?.Close(); } }); return(shellRequest); }
public Vector2?GetClosestValidPoint(Vector2 p2, List <Line> constraintLineList, List <Vector2> constraintPointList, bool isAddConstraintLinePoints = false) { List <Vector2> closestPointList = new List <Vector2>(); for (var i = 0; i < this.lineList.Count; i++) { Line line = this.lineList[i]; var closestPoint = line.GetClosestPoint(p2); closestPointList.Add(closestPoint); } //是否将限制线段的端点加进去进行最近点计算判断 if (isAddConstraintLinePoints) { for (var i = 0; i < constraintLineList.Count; i++) { Line constraintLine = constraintLineList[i]; closestPointList.Add(constraintLine.pointA); closestPointList.Add(constraintLine.pointB); } } //排序 closestPointList.Sort(delegate(Vector2 v1, Vector2 v2) { float distanceSqr1 = (p2 - v1).sqrMagnitude; float distanceSqr2 = (p2 - v2).sqrMagnitude; return(distanceSqr1 < distanceSqr2 ? -1 : distanceSqr1 == distanceSqr2 ? 0 : 1); } ); if (constraintLineList == null || constraintLineList.Count == 0) { return(closestPointList[0]); } while (closestPointList.Count != 0) { Vector2 cur = closestPointList.RemoveFirst(); bool isGotoNext = false; for (var i = 0; i < constraintLineList.Count; i++) { Line constraintLine = constraintLineList[i]; if (constraintPointList.Contains(cur)) { isGotoNext = true; break; } if (constraintLine.pointA == cur || constraintLine.pointB == cur) { return(cur); } if (constraintLine.Contains(cur)) { isGotoNext = true; break; } } if (isGotoNext) { continue; } return(cur); } LogCat.LogError("did not find closest point"); return(null); }
protected static bool Set <TargetComponent_AssetObjectType>(TargetComponent component, string assetPath, Action <TargetComponent, AssetObjectType> onLoadSuccessCallback, Action <TargetComponent, AssetObjectType> onLoadFailCallback, Action <TargetComponent, AssetObjectType> onLoadDoneCallback) where TargetComponent_AssetObjectType : AutoAssetRelease <TargetComponent, AssetObjectType> { if (component == null) { LogCat.LogError("component == null ap:" + assetPath); return(false); } TargetComponent_AssetObjectType autoAssetRelease; if (assetPath.IsNullOrWhiteSpace()) { autoAssetRelease = component.GetComponent <TargetComponent_AssetObjectType>(); if (autoAssetRelease != null) { autoAssetRelease.ReleaseAll(); } onLoadSuccessCallback(component, null); onLoadDoneCallback(component, null); return(true); } autoAssetRelease = component.gameObject.GetOrAddComponent <TargetComponent_AssetObjectType>(); var curAssetCat = autoAssetRelease.curAssetCat; var curAssetPath = autoAssetRelease.curAssetPath; var newAssetCat = Client.instance.assetBundleManager.GetOrLoadAssetCat(assetPath.GetMainAssetPath()); var newAssetPath = assetPath; if (curAssetCat != null) { if (curAssetPath.Equals(assetPath)) //cur_asset_path和asset_path相同 { //加载成功的情况 if (curAssetCat.IsLoadSuccess()) { autoAssetRelease.ReleasePreAssetCat(); // 先清除之前的记录 onLoadSuccessCallback(component, curAssetCat.Get <AssetObjectType>(assetPath.GetSubAssetPath())); onLoadDoneCallback(component, curAssetCat.Get <AssetObjectType>(assetPath.GetSubAssetPath())); return(true); } curAssetCat.AddOnLoadSuccessCallback(assetCat => onLoadSuccessCallback(component, assetCat.Get <AssetObjectType>(assetPath.GetSubAssetPath())), autoAssetRelease); curAssetCat.AddOnLoadFailCallback(assetCat => onLoadFailCallback(component, null), autoAssetRelease); curAssetCat.AddOnLoadDoneCallback(assetCat => onLoadDoneCallback(component, curAssetCat.IsLoadFail() ? null : assetCat.Get <AssetObjectType>(assetPath.GetSubAssetPath())), autoAssetRelease); return(false); } //autoAssetRelease.assetCatCur.asset_path不等于assetPath //加载成功的情况 if (curAssetCat.IsLoadSuccess()) { autoAssetRelease.ReleasePreAssetCat(); // 先清除之前的记录 autoAssetRelease.SetPreAssetCat(autoAssetRelease.curAssetCat, autoAssetRelease.curAssetPath); } else { //当前的没加载出来,直接进行ReleaseAssetCatCur,而assetCatPre不需要处理,因为当前显示为上次的assetCatPre,不然会出现空的情况 autoAssetRelease.ReleaseCurAssetCat(); } } autoAssetRelease.SetCurAssetCat(newAssetCat, newAssetPath); if (newAssetCat != null) { //加载成功 if (newAssetCat.IsLoadSuccess()) { newAssetCat.AddRefCount(); autoAssetRelease.ReleasePreAssetCat(); onLoadSuccessCallback(component, newAssetCat.Get <AssetObjectType>(assetPath.GetSubAssetPath())); onLoadDoneCallback(component, newAssetCat.Get <AssetObjectType>(assetPath.GetSubAssetPath())); return(true); } //加载中 newAssetCat.AddOnLoadSuccessCallback(assetCat => { assetCat.AddRefCount(); if (autoAssetRelease.curAssetCat != assetCat) { return; } autoAssetRelease.ReleasePreAssetCat(); onLoadSuccessCallback(component, assetCat.Get <AssetObjectType>(assetPath.GetSubAssetPath())); }, autoAssetRelease); newAssetCat.AddOnLoadFailCallback( assetCat => { onLoadFailCallback(component, assetCat.Get <AssetObjectType>(assetPath.GetSubAssetPath())); }, autoAssetRelease); newAssetCat.AddOnLoadDoneCallback( assetCat => { onLoadDoneCallback(component, assetCat.Get <AssetObjectType>(assetPath.GetSubAssetPath())); }, autoAssetRelease); return(false); } Client.instance.assetBundleManager.LoadAssetAsync(assetPath, assetCat => { assetCat.AddRefCount(); if (autoAssetRelease.curAssetCat != assetCat) { return; } autoAssetRelease.ReleasePreAssetCat(); onLoadSuccessCallback(component, assetCat.Get <AssetObjectType>()); }, assetCat => { onLoadFailCallback(component, null); }, assetCat => { onLoadDoneCallback(component, assetCat.Get <AssetObjectType>(assetPath.GetSubAssetPath())); }, autoAssetRelease); return(false); }
public CoroutineSequence Then(Action <Action, Action> thenCallback) { WaitNext(next => { thenCallback(next, () => { LogCat.LogError("TODO: kill!"); }); }); return(this); }
public static object SerializeObject(object value, object context) { Type type = value.GetType(); JsonSerializer.SerializeObjInfo serializeObjInfo = JsonSerializer.TryGetSerializedObject(type, value); if (serializeObjInfo != null) { Hashtable hashtable = new Hashtable(); hashtable[STR_CLS_TYPE] = -1; hashtable[STR_REF_ID] = serializeObjInfo.id; serializeObjInfo.classTable[STR_REF_ID] = serializeObjInfo.id; return(hashtable); } object result = null; try { if (type.IsEnum) { result = JsonSerializer.SerializeEnum(value, type); } else { if (type.IsArray) { result = JsonSerializer.SerializeArray(value, type, context); } else { if (value is IList) { result = JsonSerializer.SerializeList(value, type, context); } else if (value is IDictionary) { result = JsonSerializer.SerializeDict(value, type, context); } else { if (JsonSerializer.IsBaseType(type)) { //result = value; result = CreateValueTable(value); } else { if (UnitySerializeObjectType.IsSerializeType(type)) { result = JsonSerializer.SerializeUnityStruct(value, type, context); } else { if (type.IsClass || type.IsValueType) { result = JsonSerializer.SerializeClass(value, type, context); } else { LogCat.LogError("unsupport serialize type:" + type.ToString()); } } } } } } } catch (Exception ex) { LogCat.LogError("SerializeObject failed:" + ex.ToString()); } return(result); }
public void Hello(string s) { LogCat.LogError("hello " + s); }