static public ExcelConfigSet AddConfig(string config_name, string protocol_name = "", string file_name = "") { if (protocol_name.Length == 0) { protocol_name = string.Format("lit.config.{0}", config_name); } else { protocol_name = string.Format("lit.config.{0}", protocol_name); } if (file_name.Length == 0) { file_name = string.Format("Table/{0}.bin", config_name); } if (null != Get(config_name)) { LitLogger.ErrorFormat("configure name {0} already registered, can not register again", config_name); return(new ExcelConfigSet(factory, file_name, protocol_name)); } ExcelConfigSet ret = new ExcelConfigSet(factory, file_name, protocol_name); allConfigures[config_name] = ret; return(ret); }
public void TestConfig() { uint key = 40; var row = TableMgr.GetTableRow("hero_skill_jg", key); LitLogger.Log(row.GetString("name")); var items = row.GetFieldList("items"); LitLogger.Log("items Count : " + items.Count); foreach (var i in items) { LitLogger.Log(i); } var datas = row.GetFieldList("datas"); LitLogger.Log("datas Count : " + datas.Count); foreach (var d in datas) { var Md = d as DynamicMessage; LitLogger.Log(Md.GetInt("price")); } }
public void TestTimer() { curEvent = FaceMgr.timerMgr.RegistTimer(() => { LitLogger.Log("Test Timer"); }, 0, 10); }
protected override void Init() { if (audioPlayer == null) { audioPlayer = GetOrAddComponent <AudioSource>(); if (audioPlayer == null) { LitLogger.Error("Attach AudioSource Faild !!"); } } }
static public void ReloadAll() { foreach (var cfg in allConfigures) { cfg.Value.Reload(); } foreach (var info in factory.LastError) { LitLogger.Error(info); } }
public void PlayAudio(string audio_name, bool isLoop = false) { AudioClip clip = GetClip(audio_name); if (clip == null) { LitLogger.ErrorFormat("Can'not Found {0} audio", audio_name); return; } audioPlayer.clip = clip; audioPlayer.Play(); }
public EventEntity Serialize() { if (handler.isEmpty()) { LitLogger.ErrorFormat("Can not Add LE_OnClick with no handler"); return(null); } EventEntity eventEntity = new EventEntity(); eventEntity.EventType = LitEventType.LE_OnClick; eventEntity.EventParam = handler; return(eventEntity); }
public EventEntity Serialize() { if (script_path.isEmpty()) { LitLogger.ErrorFormat("Can not Add LE_Handler with no script_path"); return(null); } EventEntity eventEntity = new EventEntity(); eventEntity.EventType = LitEventType.LE_Handler; eventEntity.EventParam = script_path; return(eventEntity); }
public EventEntity Serialize() { if (UID.isEmpty()) { LitLogger.ErrorFormat("Can not Add LE_UID with no domain : <{0}>", gameObject.name); return(null); } EventEntity eventEntity = new EventEntity(); eventEntity.EventType = LitEventType.LE_UID; eventEntity.EventParam = UID; return(eventEntity); }
private void DrawCreateBtn() { if (GUILayout.Button("Create Handle File")) { if (!isValidPaht(handler.script_path)) { LitLogger.ErrorFormat("Invalid Path : {0}", handler.script_path); } string full_path = string.Concat(FileTools.EventHandleLuaPath, handler.script_path.Replace('.', '/'), ".lua"); EnsureFold(full_path); CreateFile(full_path); AssetDatabase.Refresh(); } }
public bool Register(string path) { lastError.Clear(); try { using (FileStream stream = File.OpenRead(path)) { return(Register(stream)); } } catch (Exception e) { LitLogger.Log(e.Message); lastError.AddLast(e.Message); return(false); } }
public void OnClick() { LitLogger.Log(this.gameObject.name + "OnClick"); if (lastClickTime + clickInterval < Time.time) { lastClickTime = Time.time; LitLua lit = GetComponent <LitLua>(); if (lit != null) { lit.GenerateEvent(LitEventType.LE_OnClick, lit); } } }
public void CallFunc(string funcFunName, object p) { try { var func = luaMgr.GetFunction(funcFunName); if (func == null) { return; } func.Push(p); func.Call(); func.EndPCall(); }catch (System.Exception e) { LitLogger.Error(e.Message); } }
public object[] CallFunc(string funcFunName, params object[] args) { try { var func = luaMgr.GetFunction(funcFunName); if (func == null) { return(null); } return(func.Call(args)); } catch (System.Exception e) { LitLogger.Error(e.Message); return(null); } }
public void TestImagePath() { LitLogger.Log(SerializeUitls.GetResPath(sprite)); }
public static void Warring(object obj) { LitLogger.Warning(obj); }
public static void Error(object obj) { LitLogger.Error(obj); }
public static void Log(object obj) { LitLogger.Log(obj); }
public void testText() { Text t = GetComponent <Text>(); LitLogger.Log(t.alignment.ToString()); }
public bool Reload() { Clear(); string full_path = FileTools.GetDocFilePath(fileName); try { var header_desc = factory.GetMsgDiscriptor("com.owent.xresloader.pb.xresloader_datablocks"); if (null == header_desc) { LitLogger.ErrorFormat("load configure file {0} failed, com.owent.xresloader.pb.xresloader_datablocks not registered", fileName); return(false); } var msg_desc = factory.GetMsgDiscriptor(protocol); if (null == msg_desc) { LitLogger.ErrorFormat("load configure file {0} failed, {1} not registered", fileName, protocol); return(false); } DynamicMessage data_set = factory.Decode(header_desc, File.OpenRead(full_path)); if (null == data_set) { LitLogger.ErrorFormat("load configure file {0} failed, {1}", fileName, factory.LastError); return(false); } foreach (var cfg_item in data_set.GetFieldList("data_block")) { DynamicMessage data_item = factory.Decode(msg_desc, new MemoryStream((byte[])cfg_item)); if (null == data_item) { LitLogger.ErrorFormat("load configure file {0} failed, {1}", fileName, factory.LastError); continue; } bool filter_pass = true; foreach (var fn in filters) { filter_pass = fn(data_item); if (!filter_pass) { break; } } if (!filter_pass) { continue; } datas.Add(data_item); foreach (var index in kvIndex) { if (null != index.Handle) { Key key = index.Handle(data_item); index.Index[key] = data_item; } } foreach (var index in klIndex) { if (null != index.Handle) { List <DynamicMessage> ls; Key key = index.Handle(data_item); if (index.Index.TryGetValue(key, out ls)) { ls.Add(data_item); } else { index.Index[key] = new List <DynamicMessage> { data_item }; } } } } foreach (var index in klIndex) { if (null != index.SortRule) { foreach (var ls in index.Index) { ls.Value.Sort(index.SortRule); } } } } catch (Exception e) { LitLogger.ErrorFormat("{0}", e.Message); return(false); } return(true); }