Example #1
0
 public CommandEsObject(PluginMessageEvent e, string command, string action, EsObject eso)
 {
     this.command = command;
     this.action  = action;
     this.eso     = eso;
     this.e       = e;
 }
Example #2
0
    protected virtual void OnPluginMessage(PluginMessageEvent e)
    {
        EsObject eso     = e.Parameters;
        string   command = eso.getString(Fields.COMMAND);
        string   action  = string.Empty;

        if (eso.variableExists(Fields.ACTION))
        {
            action = eso.getString(Fields.ACTION);
        }

        Debug.Log(this.GetType().ToString() + ": " + "time :" + System.DateTime.Now.ToString() + "eso :" + eso);

        if (command == "joinGame" || listWaitingGameplay.Count > 0)
        {
            Debug.LogWarning("CServer -> Gameplay chờ command : " + command);
            if (command == "joinGame")
            {
                ProcessGeneral(command, action, eso);
                listWaitingGameplay.Add(null);
            }
            else
            {
                listWaitingGameplay.Add(new CommandEsObject(e, command, action, eso));
            }
        }
        else
        {
            ProcessPluginMessage(e, command, action, eso);
        }
    }
Example #3
0
    /// <summary>
    /// Process plugin message from server response
    /// </summary>
    void ProcessPluginMessage(PluginMessageEvent e, string command, string action, EsObject eso)
    {
        ProcessGeneral(command, action, eso);
        if (EventPluginMessageOnProcess != null)
        {
            //Trường hợp các phòng mà không phải đang đứng ở đó nhưng server vẫn trả về thông tin
            if ((e.OriginRoomId != GameManager.Instance.currentRoom.roomId || e.OriginZoneId != GameManager.Instance.currentRoom.zoneId) &&
                (command == Fields.RESPONSE.LOBBY_UPDATE || command == Fields.RESPONSE.USER_ONLINE_UPDATE))
            {
                if (command == Fields.RESPONSE.USER_ONLINE_UPDATE && EventGameplayUpdateUserOnline != null)
                {
                    EventGameplayUpdateUserOnline(command, action, eso);
                }
                else
                {
                    Debug.Log("SKIP----> " + e.OriginRoomId + " - " + e.OriginZoneId + "- command=" + command);
                }
                return;
            }

            EventPluginMessageOnProcess(command, action, eso);
        }
    }
    /**
     * Called when a plugin message arrives.
     * 
     */
    private void onPluginMessageEvent(PluginMessageEvent e)
    {
        if (e.PluginName != LobbyConstants.PLUGIN_NAME)
        {
            // we aren't interested, don't know how to process it
            return;
        }

        EsObject esob = e.Parameters;
        //trace the EsObject payload; comment this out after debugging finishes!
        //Debug.Log("Plugin event: " + esob.ToString());

        //get the action which determines what we do next
        string action = esob.getString(LobbyConstants.ACTION);
        if (action == LobbyConstants.GAMES_FOUND)
        {
            handleGamesFoundEvent(esob);
        }
        else if (action == LobbyConstants.NO_GAMES_FOUND)
        {
            handleNoGamesFoundEvent();
        }
        else
        {
            Debug.Log("Action not handled: " + action);
        }

    }
    /**
     * Called when a plugin message arrives.
     * 
     */
    private void onPluginMessageEvent(PluginMessageEvent e)
    {
        if (e.PluginName != GameConstants.PLUGIN_NAME)
        {
            // we aren't interested, don't know how to process it
            return;
        }

        EsObject esob = e.Parameters;
        //trace the EsObject payload; comment this out after debugging finishes!
        //Debug.Log("Plugin event: " + esob.ToString());

        //get the action which determines what we do next
        string action = esob.getString(LobbyConstants.ACTION);

        if (action == GameConstants.START_GAME)
        {
            handleStartGame(esob);
        }
        else if (action == GameConstants.MOVE_RESPONSE)
        {
            handleMoveResponse(esob);
        }
        else if (action == GameConstants.MOVE_EVENT)
        {
            handleMoveEvent(esob);
        }
        else if (action == GameConstants.TURN_TIME_LIMIT)
        {
            handleTurnAnnouncement(esob);
        }
        else if (action == GameConstants.GAME_OVER)
        {
            handleGameOver(esob);
        }
        else if (action == GameConstants.INIT_ME)
        {
            // for game restarts only
            handleGameRestart(esob);
        }
        else
        {
            Debug.Log("Action not handled: " + action);
        }

    }
    /**
     * Called when a plugin message arrives.
     * 
     */
    private void onPluginMessageEvent(PluginMessageEvent e)
    {
        if (e.PluginName != PLUGIN_NAME)
        {
            // we aren't interested, don't know how to process it
            return;
        }

        EsObject esob = e.Parameters;
        //trace the EsObject payload; comment this out after debugging finishes!
        //Log("Plugin event: " + esob.ToString());

        //get the action which determines what we do next
        string action = esob.getString(PluginTags.ACTION);
        if (action == PluginTags.POSITION_UPDATE_EVENT)
        {
            handlePositionUpdateEvent(esob);
        }
        else if (action == PluginTags.AVATAR_STATE_EVENT)
        {
            SendAnimationMessageToRemotePlayerObject(esob);
        }
        else if (action == PluginTags.USER_LIST_RESPONSE)
        {
            handleUserListResponse(esob);
        }
        else if (action == PluginTags.USER_ENTER_EVENT)
        {
            handleUserEnterEvent(esob);
        }
        else if (action == PluginTags.USER_EXIT_EVENT)
        {
            handleUserExitEvent(esob);
        }
        else
        {
            Log("Action not handled: " + action);
        }

    }