本文整理汇总了C#中Commands.Command方法的典型用法代码示例。如果您正苦于以下问题:C# Commands.Command方法的具体用法?C# Commands.Command怎么用?C# Commands.Command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Commands
的用法示例。
在下文中一共展示了Commands.Command方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnGUI
public void OnGUI()
{
com = GetComponent<Commands>();
if (!this.IsVisible || PhotonNetwork.connectionStateDetailed != PeerState.Joined)
{
return;
}
if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.KeypadEnter || Event.current.keyCode == KeyCode.Return))
{
if (!string.IsNullOrEmpty(this.inputLine))
{
if (inputLine[0] == '/'){
com.Command(inputLine);
this.inputLine = "";
GUI.FocusControl("");
return;
}
else {
this.photonView.RPC("Chat", PhotonTargets.All, this.inputLine);
this.inputLine = "";
GUI.FocusControl("");
return; // printing the now modified list would result in an error. to avoid this, we just skip this single frame
}}
else
{
GUI.FocusControl("ChatInput");
}
}
GUI.SetNextControlName("");
GUILayout.BeginArea(this.GuiRect);
scrollPos = GUILayout.BeginScrollView(scrollPos);
GUILayout.FlexibleSpace();
for (int i = messages.Count - 1; i >= 0; i--)
{
GUILayout.Label(messages[i]);
}
GUILayout.EndScrollView();
GUILayout.BeginHorizontal();
GUI.SetNextControlName("ChatInput");
inputLine = GUILayout.TextField(inputLine);
if (GUILayout.Button("Send", GUILayout.ExpandWidth(false)))
{
this.photonView.RPC("Chat", PhotonTargets.All, this.inputLine);
this.inputLine = "";
GUI.FocusControl("");
}
GUILayout.EndHorizontal();
GUILayout.EndArea();
}