public void GiveInventory(Command.Exec e) { string itemName = e.tok.GetToken(1).ToString(); //GetStr(1, Commander.Instance.GetScope()); //Show.Log("Give " + itemName + " (" + e.tok.ToString() + ")"); Inventory inv = main; GameObject itemObj = inv.RemoveItem(itemName); if (itemObj != null) { if (e.tok.TokenCount == 2 || e.tok.GetToken(2).ToString() == ";") { UnityEngine.Object.Destroy(itemObj); //Show.Log("giving to nobody... destroying"); //e.print("destroying " + itemName); } else { Token recieptiant = e.tok.GetToken(2); string message = "TODO give " + itemObj + " to " + recieptiant; Show.Warning(message); e.print(message); } } else { string message = "missing " + itemName + ". have: " + inv.GetItems().JoinToString(", ", go => go.name); Show.Warning(message); e.print(message); } }
public void Cmd_Cd(Command.Exec e) { Arguments args = e.GetArgs(); //Debug.Log(args); args.TryGet("/", out string dir); args.TryGet("..", out bool backDir); if ((dir == ".." || backDir) && workingTransform != null) { workingTransform = workingTransform.parent; //Show.Log("backing up"); return; } List <KeyValuePair <string, object> > list = Listing(workingTransform); for (int i = 0; i < list.Count; ++i) { //Show.Log(list[i].Key+","+dir); if (list[i].Key == dir) { workingTransform = list[i].Value as Transform; //Show.Log("found " + dir + ", heading into " + list[i].Value.GetType()); //Show.Log(workingTransform); return; } } }
public void Cmd_Clear(Command.Exec e) { UnityConsole console = GetComponent <UnityConsole>(); console.body.Clear(); console.Cursor = Coord.Zero; console.Window.viewRect.Position = Coord.Zero; console.Window.UpdatePosition(); }
public void Cmd_Dir(Command.Exec e) { List <KeyValuePair <string, object> > list = Listing(workingTransform); UnityConsole console = GetComponent <UnityConsole>(); for (int i = 0; i < list.Count; ++i) { console.WriteLine(list[i].Key); } }
public void Cmd_Pwd(Command.Exec e) { UnityConsole console = GetComponent <UnityConsole>(); string pwd = "/"; if (workingTransform != null) { pwd += workingTransform.HierarchyPath(); } console.WriteLine(pwd); }
public void Cmd_Pause(Command.Exec e) { Arguments args = e.GetArgs(); if (args.TryGet("0", out bool unpause)) { GameClock.Instance().Unpause(); } else { GameClock.Instance().Pause(); } }
public void Update(Command.Exec inst) //, CmdLine_base cmd) { bool somethingPrinted = false; if (log != null) { while (log.Count > 0) { //cmd.HandleLog(log[0], "", CmdLine_base.LogType.Log); inst.print(log[0]); log.RemoveAt(0); somethingPrinted = true; } } if (err != null) { while (err.Count > 0) { //cmd.HandleLog(err[0], "", CmdLine_base.LogType.Error); inst.print(err[0]); err.RemoveAt(0); somethingPrinted = true; } } string s = null; if (inst != null) { s = inst.tok.str; if (s != null) { DoCommand(s, inst.src); } } if (string.IsNullOrEmpty(s) && string.IsNullOrEmpty(currentCommand) && (somethingPrinted || promptNeedsRedraw)) { //cmd.NeedToRefreshUserPrompt = true; } //if (cmd.NeedToRefreshUserPrompt) //{ // promptNeedsRedraw = false; //} }
public void Cmd_Echo(Command.Exec e) { UnityConsole console = GetComponent <UnityConsole>(); StringBuilder sb = new StringBuilder(); for (int i = 1; i < e.tok.tokens.Count; ++i) { object result = e.tok.tokens[i].Resolve(e.tok, e.src); if (result == null) { result = ""; } if (!(result is string)) { result = result.StringifySmall(); } sb.Append(result.ToString()); } console.WriteLine(sb.ToString()); }
public void ClaimPlayer(Command.Exec e) { GameObject npc = DialogManager.Instance.dialogWithWho; Global.GetComponent <Team>().AddMember(npc); MazeLevel ml = Global.GetComponent <MazeLevel>(); Discovery d = EnsureExplorer(npc); ParticleSystem ps = npc.GetComponentInChildren <ParticleSystem>(); Color color = ps.main.startColor.color; d.discoveredFloor = Color.Lerp(d.discoveredFloor, color, 0.25f); d.discoveredWall = Color.Lerp(d.discoveredWall, color, 0.25f); d.discoveredRamp = Color.Lerp(d.discoveredRamp, color, 0.25f); d.maze = ml; Global.GetComponent <ConditionCheck>().DoActivateTest(); InventoryCollector inv = npc.GetComponentInChildren <InventoryCollector>(); inv.inventory = InventoryManager.main; inv.autoPickup = true; ScriptedDictionary dict = npc.GetComponent <ScriptedDictionary>(); dict["cooperative"] = true; }
public void Show(Command.Exec e) { ActiveDialog.Show(); }
public void SetMainInventory(Command.Exec e) { string n = e.tok.GetStr(1, Commander.Instance.GetScope()); SetMainInventory(n); }
public void StartDialog(Command.Exec e) { ActiveDialog.StartDialog(e.src, e.tok, e.tok.GetStr(1)); }
public void ContinueDialog(Command.Exec e) { ActiveDialog.ContinueDialog(e.src, e.tok, e.tok.GetStr(1)); }
public void Done(Command.Exec e) { ActiveDialog.Done(); }
public void Cmd_Help(Command.Exec e) { CommanderInstance.Cmd_Help_Handler(e); }
public void Hide(Command.Exec e) { ActiveDialog.Hide(); }
public void Cmd_Exit(Command.Exec e) { PlatformAdjust.Exit(); }