public override void Analysis(string value) { string methodName; string[] arguments; Analysis(value, out methodName, out arguments); if (!funList.ContainsKey(methodName)) { base.Analysis(value); return; } Dictionary <string, List <string> > funArr = funList[methodName]; List <string> paramList = funArr["param"]; for (int i = 0; i < paramList.Count; i++) { LSharpVarlable.SetVarlable(paramList[i], arguments[i]); } List <string> funLineList = funArr["function"]; foreach (string line in funLineList) { LSharpScript.Instance.UnshiftLine(line); } LSharpScript.Instance.Analysis(); }
public override void Analysis() { UnityEngine.Debug.LogError("LSharpScript Analysis"); string lineValue = ""; if (lineList == null) { return; } if (lineList.Count == 0) { if (dataList.Count > 0) { dataList.RemoveAt(0); } if (dataList.Count > 0) { List <string>[] arr = dataList[0]; lineList = arr[1]; copyList = arr[2]; Analysis(); } return; } while (lineList.Count > 0 && lineValue.Length == 0) { lineValue = lineList[0].Trim(); lineList.RemoveAt(0); } if (string.IsNullOrEmpty(lineValue.Trim())) { Analysis(); return; } lineValue = LSharpVarlable.GetVarlable(lineValue); Debug.Log("lineValue = " + lineValue); if (lineValue.IndexOf("if", StringComparison.Ordinal) >= 0) { LSharpIf.GetIf(lineValue); return; } else if (lineValue.IndexOf("function", StringComparison.Ordinal) >= 0) { LSharpFunction.AddFunction(lineValue); return; } string[] sarr = lineValue.Split('.'); string key = sarr[0]; Debug.Log("key = " + key + ", " + subClasses.ContainsKey(key)); if (subClasses.ContainsKey(key)) { object subClass = subClasses[key]; CallAnalysis(subClass, lineValue); } else { Analysis(); } }
public void UpdatePlayer() { App.Model.MCharacter mCharacter = System.Array.Find(Global.SUser.self.characters, c => c.CharacterId >= App.Util.Global.Constant.user_characters[0]); LSharpVarlable.SetVarlable("player_character_id", mCharacter.CharacterId.ToString()); LSharpVarlable.SetVarlable("player_id", Global.SUser.self.id.ToString()); LSharpVarlable.SetVarlable("player_name", Global.SUser.self.name); LSharpVarlable.SetVarlable("player_nickname", Global.SUser.self.Nickname); LSharpVarlable.SetVarlable("player_claim", Language.Get(string.Format("player_claim_{0}", mCharacter.Gender.ToString()))); LSharpVarlable.SetVarlable("player_claim_called", Language.Get(string.Format("player_claim_called_{0}", mCharacter.Gender.ToString()))); }
public void UpdateBattleList() { if (Global.SUser.self == null) { return; } foreach (App.Model.MBattleChild mBattleChild in Global.SUser.self.battlelist) { LSharpVarlable.SetVarlable(string.Format("battlefield_{0}", mBattleChild.BattlefieldId), "1"); } }
public void UpdateVarList() { if (Global.SUser.self.Progress != null) { Dictionary <string, int> progress = Global.SUser.self.Progress; foreach (string k in progress.Keys) { LSharpVarlable.SetVarlable(k, progress[k].ToString()); } } }
public static void GetIf(string lineValue) { int start = lineValue.IndexOf("(", System.StringComparison.Ordinal); int end = lineValue.IndexOf(")", System.StringComparison.Ordinal); string str = lineValue.Substring(start + 1, end - start - 1); string[] ifArr = str.Split(new string[] { "&&" }, System.StringSplitOptions.RemoveEmptyEntries); bool ifvalue = LSharpIf.CheckCondition(ifArr); bool ifvalueend = false; int sCount = 0; int eCount = 0; List <string> childArray = new List <string>(); while (LSharpScript.Instance.LineListCount > 0) { sCount = 0; string child = LSharpScript.Instance.ShiftLine(); if (child.IndexOf("elseif", System.StringComparison.Ordinal) >= 0) { if (ifvalue) { ifvalueend = true; continue; } start = child.IndexOf("(", System.StringComparison.Ordinal); end = child.IndexOf(")", System.StringComparison.Ordinal); str = child.Substring(start + 1, end - start - 1); str = LSharpVarlable.GetVarlable(str); ifArr = str.Split(new string[] { "&&" }, System.StringSplitOptions.RemoveEmptyEntries); ifvalue = LSharpIf.CheckCondition(ifArr); continue; } else if (child.IndexOf("else", System.StringComparison.Ordinal) >= 0) { if (ifvalue) { ifvalueend = true; continue; } ifvalue = true; continue; } else if (child.IndexOf("endif", System.StringComparison.Ordinal) >= 0) { break; } else if (child.IndexOf("if", System.StringComparison.Ordinal) >= 0) { if (ifvalue && !ifvalueend) { childArray.Add(child); } sCount = 1; eCount = 0; while (sCount > eCount) { string subChild = LSharpScript.Instance.ShiftLine(); if (subChild.IndexOf("if", System.StringComparison.Ordinal) >= 0 && subChild.IndexOf("else", System.StringComparison.Ordinal) < 0 && subChild.IndexOf("end", System.StringComparison.Ordinal) < 0) { sCount++; } else if (subChild.IndexOf("endif", System.StringComparison.Ordinal) >= 0) { eCount++; } if (ifvalue && !ifvalueend) { childArray.Add(subChild); } } } if (sCount == 0) { if (ifvalue && !ifvalueend) { childArray.Add(child); } } } for (var i = childArray.Count - 1; i >= 0; i--) { LSharpScript.Instance.UnshiftLine(childArray[i]); } LSharpScript.Instance.Analysis(); }