Beispiel #1
0
    void Awake()
    {
        this.received_msg = "";

        this.gameserver = new CLocalServer();
        this.gameserver.appcallback_on_message += on_message;
    }
Beispiel #2
0
    public void send(CPacket msg)
    {
        CPacket clone = CLocalServer.pre_send(msg);

        CPacket.destroy(msg);
        on_receive(clone);
    }
    void send(CPacket msg)
    {
        CPacket clone = CLocalServer.pre_send(msg);

        CPacket.destroy(msg);
        this.appcallback_on_message(clone);
    }
Beispiel #4
0
 public CGameRoom(CLocalServer server)
 {
     this.server            = server;
     this.engine            = new CGostopEngine();
     this.players           = new List <CPlayer>();
     this.received_protocol = new Dictionary <byte, PROTOCOL>();
 }
Beispiel #5
0
 public CGameRoom(CLocalServer server)
 {
     this.server = server;
     this.engine = new CGostopEngine();
     this.players = new List<CPlayer>();
     this.received_protocol = new Dictionary<byte, PROTOCOL>();
     this.order_manager = new CPlayerOrderManager();
 }
 public void start_localserver()
 {
     for (int i = 0; i < this.players.Count; ++i)
     {
         CPacket msg   = CPacket.create((short)PROTOCOL.LOCAL_SERVER_STARTED);
         CPacket clone = CLocalServer.pre_send(msg);
         this.players[i].send(clone);
     }
 }
Beispiel #7
0
    public CPlayer(byte player_index, PLAYER_TYPE player_type, SendFn send_function, CLocalServer local_server)
    {
        this.player_index = player_index;
        this.agent        = new CPlayerAgent(player_index);
        this.player_type  = player_type;

        switch (this.player_type)
        {
        case PLAYER_TYPE.HUMAN:
            this.send_function = send_function;
            break;

        case PLAYER_TYPE.AI:
            this.ai_logic      = new CAIPlayer(local_server);
            this.send_function = this.ai_logic.send;
            break;
        }
    }
    public CAIPlayer(CLocalServer local_server)
    {
        this.local_server = local_server;
        this.hand_cards   = new List <CCard>();
        reset();

        this.packet_handler = new Dictionary <PROTOCOL, PacketFn>();
        this.packet_handler.Add(PROTOCOL.LOCAL_SERVER_STARTED, ON_LOCAL_SERVER_STARTED);
        this.packet_handler.Add(PROTOCOL.BEGIN_CARD_INFO, ON_BEGIN_CARD_INFO);
        this.packet_handler.Add(PROTOCOL.START_TURN, ON_START_TURN);
        this.packet_handler.Add(PROTOCOL.CHOICE_ONE_CARD, ON_CHOICE_ONE_CARD);
        this.packet_handler.Add(PROTOCOL.SELECT_CARD_ACK, ON_SELECT_CARD_ACK);
        this.packet_handler.Add(PROTOCOL.FLIP_DECK_CARD_ACK, ON_FLIP_DECK_CARD_ACK);
        this.packet_handler.Add(PROTOCOL.TURN_RESULT, ON_TURN_RESULT);
        this.packet_handler.Add(PROTOCOL.ASK_GO_OR_STOP, ON_ASK_GO_OR_STOP);
        this.packet_handler.Add(PROTOCOL.ASK_KOOKJIN_TO_PEE, ON_ASK_KOOKJIN_TO_PEE);
        this.packet_handler.Add(PROTOCOL.GAME_RESULT, ON_GAME_RESULT);
    }
Beispiel #9
0
    public CPlayer(byte player_index, PLAYER_TYPE player_type, SendFn send_function, CLocalServer local_server)
    {
        this.player_index = player_index;
        this.agent = new CPlayerAgent(player_index);
        this.player_type = player_type;

        switch (this.player_type)
        {
            case PLAYER_TYPE.HUMAN:
                this.send_function = send_function;
                break;

            case PLAYER_TYPE.AI:
                this.ai_logic = new CAIPlayer(local_server);
                this.send_function = this.ai_logic.send;
                break;
        }
    }
Beispiel #10
0
    public CAIPlayer(CLocalServer local_server)
    {
        this.local_server = local_server;
        this.brain = new CBrain();
        this.hand_cards = new List<CCard>();
        this.floor_card_manager = new CFloorCardManager();
        reset();

        this.packet_handler = new Dictionary<PROTOCOL, PacketFn>();
        this.packet_handler.Add(PROTOCOL.LOCAL_SERVER_STARTED, ON_LOCAL_SERVER_STARTED);
        this.packet_handler.Add(PROTOCOL.BEGIN_CARD_INFO, ON_BEGIN_CARD_INFO);
        this.packet_handler.Add(PROTOCOL.START_TURN, ON_START_TURN);
        this.packet_handler.Add(PROTOCOL.SELECT_CARD_ACK, ON_SELECT_CARD_ACK);
        this.packet_handler.Add(PROTOCOL.FLIP_DECK_CARD_ACK, ON_FLIP_DECK_CARD_ACK);
        this.packet_handler.Add(PROTOCOL.TURN_RESULT, ON_TURN_RESULT);
        this.packet_handler.Add(PROTOCOL.ASK_GO_OR_STOP, ON_ASK_GO_OR_STOP);
        this.packet_handler.Add(PROTOCOL.ASK_KOOKJIN_TO_PEE, ON_ASK_KOOKJIN_TO_PEE);
        this.packet_handler.Add(PROTOCOL.GAME_RESULT, ON_GAME_RESULT);
    }