コード例 #1
0
 // Token: 0x0600132F RID: 4911 RVA: 0x0007A4A0 File Offset: 0x000788A0
 private void Awake()
 {
     for (int i = 0; i < 8; i++)
     {
         GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.hintTemplate);
         gameObject.name = "Hint";
         gameObject.SetActive(false);
         RectTransform rectTransform = gameObject.transform as RectTransform;
         rectTransform.SetParent(this.hintContainer, false);
         rectTransform.anchoredPosition += new Vector2(0f, (float)i * rectTransform.sizeDelta.y);
         Text         component = rectTransform.FindChild("Text").GetComponent <Text>();
         TerminalHint item      = new TerminalHint(gameObject, component);
         this.hints.Add(item);
     }
 }
コード例 #2
0
 // Token: 0x0600131E RID: 4894 RVA: 0x00079A10 File Offset: 0x00077E10
 private void onCommandFieldChanged(string value)
 {
     this.arguments = TerminalUtility.splitArguments(value);
     if (this.arguments.Count == 0)
     {
         this.commands.Clear();
     }
     else if (this.arguments.Count == 1)
     {
         this.commands = TerminalUtility.filterCommands(this.arguments[0]);
     }
     for (int i = 0; i < this.hints.Count; i++)
     {
         TerminalHint terminalHint = this.hints[i];
         terminalHint.isVisible = (i < this.commands.Count);
         if (terminalHint.isVisible)
         {
             if (this.commands.Count == 1 && this.arguments.Count > 1 && this.arguments.Count <= this.commands[i].parameters.Length + 1)
             {
                 StringBuilder instance = StringBuilderUtility.instance;
                 instance.Append(this.commands[i].parameters[this.arguments.Count - 2].name);
                 instance.Append(" - ");
                 instance.Append(this.commands[i].parameters[this.arguments.Count - 2].type.Name.ToLower());
                 instance.Append("\n");
                 instance.Append("<color=#afafaf>");
                 instance.Append(this.commands[i].parameters[this.arguments.Count - 2].description);
                 if (this.commands[i].parameters[this.arguments.Count - 2].defaultValue != null)
                 {
                     string value2 = this.commands[i].parameters[this.arguments.Count - 2].defaultValue.ToString().ToLower();
                     if (!string.IsNullOrEmpty(value2))
                     {
                         instance.Append(" [default: ");
                         instance.Append(value2);
                         instance.Append("]");
                     }
                 }
                 if (this.commands[i].currentValue != null)
                 {
                     string value3 = this.commands[i].currentValue.Invoke(null, null).ToString().ToLower();
                     if (!string.IsNullOrEmpty(value3))
                     {
                         instance.Append(" [current: ");
                         instance.Append(value3);
                         instance.Append("]");
                     }
                 }
                 instance.Append("</color>");
                 terminalHint.text = instance.ToString();
             }
             else
             {
                 StringBuilder instance2 = StringBuilderUtility.instance;
                 instance2.Append(this.commands[i].method.command);
                 instance2.Insert(Mathf.Clamp(this.arguments[0].Length, 0, this.commands[i].method.command.Length), "</color>");
                 instance2.Insert(0, ">");
                 instance2.Insert(0, Terminal.highlightColor);
                 instance2.Insert(0, "<color=");
                 for (int j = 0; j < this.commands[i].parameters.Length; j++)
                 {
                     instance2.Append(" - ");
                     instance2.Append(this.commands[i].parameters[j].type.Name.ToLower());
                 }
                 instance2.Append("\n");
                 instance2.Append("<color=#afafaf>");
                 instance2.Append(this.commands[i].method.description);
                 instance2.Append("</color>");
                 terminalHint.text = instance2.ToString();
             }
         }
     }
 }