void Start() { if (!GamePlayer.IsNetworked()) { Destroy(this.gameObject); return; } canvas = gameObject.GetComponent <Canvas>() as Canvas; canvas.enabled = false; contentHolder = GameObject.Find("chat_text"); messageTemplate = transform.Find("msg_template").gameObject; messageTemplate.SetActive(false); groupContainer = GameObject.Find("group_container"); groupMemberContainer = GameObject.Find("group_member_container"); groupMemberTemplate = GameObject.Find("group_member"); groupMemberTemplate.SetActive(false); groupContainer.SetActive(false); chatInput = GameObject.Find("chat_input").GetComponent <InputField>() as InputField; playerId = GameEntityManager.GetPlayerEntity().GetEntityId(); characterId = GameEntityManager.GetPlayerEntity().GetCharacterId(); messenger = ActorSystem.instance.Find("Messenger") as Messenger; chatCommandHandler = new ChatCommandHandler(messenger, this, playerId); Messenger.ChannelJoined channelCallback = ChannelJoined; messenger.OnChannelJoined(channelCallback); Messenger.ChannelLeft channelLeftCallback = ChannelLeft; messenger.OnChannelLeft(channelLeftCallback); Messenger.MessageReceived messageCallback = MessageReceived; messenger.OnMessageReceived(messageCallback); Messenger.InviteReceived inviteCallback = InviteReceived; messenger.OnInviteReceived(inviteCallback); foreach (string channel in autojoinChannels) { messenger.JoinChannel(channel); } InvokeRepeating("UpdateChatStatus", 0.01f, 2.0F); }
void Start() { canvas = gameObject.GetComponent<Canvas>() as Canvas; canvas.enabled = false; scrollbar = GameObject.Find("chat_scrollbar"); contentHolder = GameObject.Find("chat_text"); messageTemplate = transform.Find("msg_template").gameObject; messageTemplate.SetActive(false); groupContainer = GameObject.Find("group_container"); groupMemberContainer = GameObject.Find("group_member_container"); groupMemberTemplate = GameObject.Find("group_member"); groupMemberTemplate.SetActive(false); groupContainer.SetActive(false); chatInput = GameObject.Find("chat_input").GetComponent<InputField>() as InputField; playerId = GameEntityManager.GetPlayerEntity().GetEntityId(); characterId = GameEntityManager.GetPlayerEntity().GetCharacterId(); messenger = ActorSystem.instance.Find("Messenger") as Messenger; chatCommandHandler = new ChatCommandHandler(messenger, this, playerId); Messenger.ChannelJoined channelCallback = ChannelJoined; messenger.OnChannelJoined(channelCallback); Messenger.ChannelLeft channelLeftCallback = ChannelLeft; messenger.OnChannelLeft(channelLeftCallback); Messenger.MessageReceived messageCallback = MessageReceived; messenger.OnMessageReceived(messageCallback); Messenger.InviteReceived inviteCallback = InviteReceived; messenger.OnInviteReceived(inviteCallback); foreach (string channel in autojoinChannels) { messenger.JoinChannel(channel); } InvokeRepeating("UpdateChatStatus", 0.01f, 2.0F); }