Inheritance: GameMachine.Core.UntypedActor
Exemplo n.º 1
0
 public ChatCommandHandler(Messenger messenger, IChatUI chatUI, string playerId)
 {
     this.messenger = messenger;
     this.chatUI = chatUI;
     this.playerId = playerId;
     groupName = "priv_" + playerId + "_group";
 }
Exemplo n.º 2
0
        public void StartCoreActors()
        {
            // Actors that come with GameMachine

            Messenger messenger = new Messenger();
            messenger.AddComponentSet("ChatMessage");
            messenger.AddComponentSet("ChatChannels");
            messenger.AddComponentSet("ChatInvite");
            ActorSystem.instance.RegisterActor(messenger);

            remoteEcho = new RemoteEcho();
            remoteEcho.AddComponentSet("EchoTest");
            actorSystem.RegisterActor(remoteEcho);

            RemoteEcho.EchoReceived callback = OnEchoReceived;
            remoteEcho.OnEchoReceived(callback);

            running = true;
            RunOnRunningCallbacks();
            //Debug.Log("App running - waiting to verify connection");
        }
Exemplo n.º 3
0
 void Start()
 {
     windowWidth = 190;
     windowHeight = 50;
     windowLeft = Screen.width - 200;
     windowTop = 200;
     groupWindow = new Rect (windowLeft, windowTop, windowWidth, windowHeight);
     messenger = ActorSystem.instance.Find ("Messenger") as Messenger;
 }
Exemplo n.º 4
0
        public void Init(ChatApi chatApi)
        {
            this.chatApi = chatApi;
            // Gui component.
            chatbox = this.gameObject.AddComponent<Chatbox>() as Chatbox;
            chatbox.CloseChatWindow();

            // The messaging actor
            messenger = ActorSystem.instance.Find("Messenger") as Messenger;

            // Parses the chat language used by the gui and calls messenger
            // Feel free to provide your own implementation, this is mostly a starting point.
            // Supported syntax is documented in the source
            chatCommands = new ChatCommands(messenger, chatbox);
            chatCommands.SetChatApi(chatApi);

            // Setup callacks so we get notified when we join/leave channels and receive messages
            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);

            // Send this whenever you want a list of subscribed channels, and the optional
            // subscriber list if you have set the subscribers flag.  We do it on an interval
            // so that you get notified when new players join a group you are in.
            // For matchmaking you probably want this value lower so it appears more
            // responsive.  For mmo type games it could be somewhat higher.
            InvokeRepeating("UpdateChatStatus", 0.01f, 5.0F);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 public ChatCommands(Messenger _messenger, Chatbox chatbox)
 {
     messenger = _messenger;
     this.chatbox = chatbox;
 }