public MainController(Context ctx) : base(ctx)
        {
            _name = "main";

            //EventListenerCmd listener1 = new EventListenerCmd(MyEventCmd.EVENT_MUI_CREATE, OnSendCreate);
            //_ctx.EventDispatcher.AddCmdEventListener(listener1);

            //EventListenerCmd listener2 = new EventListenerCmd(MyEventCmd.EVENT_MUI_JOIN, OnSendJoin);
            //_ctx.EventDispatcher.AddCmdEventListener(listener2);

            //EventListenerCmd listener3 = new EventListenerCmd(MyEventCmd.EVENT_MUI_MSG, OnSendMsg);
            //_ctx.EventDispatcher.AddCmdEventListener(listener3);

            //EventListenerCmd listener4 = new EventListenerCmd(MyEventCmd.EVENT_MUI_VIEWMAIL, OnSendViewMail);
            //_ctx.EventDispatcher.AddCmdEventListener(listener4);

            //EventListenerCmd listener5 = new EventListenerCmd(MyEventCmd.EVENT_MUI_VIEWEDMAIL, OnViewedMail);
            //_ctx.EventDispatcher.AddCmdEventListener(listener5);

            //EventListenerCmd listener6 = new EventListenerCmd(MyEventCmd.EVENT_MUI_MSGCLOSED, OnMsgClosed);
            //_ctx.EventDispatcher.AddCmdEventListener(listener6);

            //EventListenerCmd listener7 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_MUI, SetupUI);
            //_ctx.EventDispatcher.AddCmdEventListener(listener7);

            //EventListenerCmd listener8 = new EventListenerCmd(MyEventCmd.EVENT_MUI_SHOWCREATE, OnShowCreate);
            //_ctx.EventDispatcher.AddCmdEventListener(listener8);

            //EventListenerCmd listener9 = new EventListenerCmd(MyEventCmd.EVENT_MUI_EXITLOGIN, OnLogout);
            //_ctx.EventDispatcher.AddCmdEventListener(listener9);

            EventListenerCmd listener9 = new EventListenerCmd(MyEventCmd.EVENT_MUI_MATCH, OnSendMatch);

            _ctx.EventDispatcher.AddCmdEventListener(listener9);
        }
        public StartController(Context ctx) : base(ctx)
        {
            _startActor = new StartActor(ctx, this);

            EventListenerCmd listener2 = new EventListenerCmd(EventCmd.EVENT_START_SETUP_ROOT, SetupRoot);

            _ctx.EventDispatcher.AddCmdEventListener(listener2);
        }
Exemple #3
0
        public GameController(Context ctx) : base(ctx)
        {
            _service = _ctx.QueryService <GameService>(GameService.Name);
            _ui      = new GUIRootActor(_ctx, this);
            _type    = GameType.GAME;

            EventListenerCmd listener1 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_SCENE, SetupScene);

            _ctx.EventDispatcher.AddCmdEventListener(listener1);

            EventListenerCmd listener2 = new EventListenerCmd(MyEventCmd.EVENT_BOXINGCARDS, BoxingCards);

            _ctx.EventDispatcher.AddCmdEventListener(listener2);

            EventListenerCmd listener5 = new EventListenerCmd(MyEventCmd.EVENT_THROWDICE, OnThrowDice);

            _ctx.EventDispatcher.AddCmdEventListener(listener5);

            EventListenerCmd listener6 = new EventListenerCmd(MyEventCmd.EVENT_TAKEDEAL, OnTakeDeal);

            _ctx.EventDispatcher.AddCmdEventListener(listener6);

            EventListenerCmd listener7 = new EventListenerCmd(MyEventCmd.EVENT_PENGCARD, PengCard);

            _ctx.EventDispatcher.AddCmdEventListener(listener7);

            EventListenerCmd listener8 = new EventListenerCmd(MyEventCmd.EVENT_GANGCARD, GangCard);

            _ctx.EventDispatcher.AddCmdEventListener(listener8);

            EventListenerCmd listener9 = new EventListenerCmd(MyEventCmd.EVENT_HUCARD, HuCard);

            _ctx.EventDispatcher.AddCmdEventListener(listener9);

            EventListenerCmd listener10 = new EventListenerCmd(MyEventCmd.EVENT_SORTCARDSAFTERDEAL, OnSortCardsAfterDeal);

            _ctx.EventDispatcher.AddCmdEventListener(listener10);

            EventListenerCmd listener11 = new EventListenerCmd(MyEventCmd.EVENT_LEADCARD, OnLeadCard);

            _ctx.EventDispatcher.AddCmdEventListener(listener11);

            EventListenerCmd listener12 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_BOARD, SetupMap);

            _ctx.EventDispatcher.AddCmdEventListener(listener12);

            EventListenerCmd listener13 = new EventListenerCmd(MyEventCmd.EVENT_SENDCHATMSG, OnSendChatMsg);

            _ctx.EventDispatcher.AddCmdEventListener(listener13);

            EventListenerCmd listener14 = new EventListenerCmd(MyEventCmd.EVENT_TAKEFIRSTCARD, OnTakeFirstCard);

            _ctx.EventDispatcher.AddCmdEventListener(listener14);

            EventListenerCmd listener15 = new EventListenerCmd(MyEventCmd.EVENT_SETTLE_NEXT, OnSettleNext);

            _ctx.EventDispatcher.AddCmdEventListener(listener15);
        }
Exemple #4
0
        public GameService(Context ctx) : base(ctx)
        {
            EventListenerCmd listener1 = new EventListenerCmd(MyEventCmd.EVENT_LOADEDCARDS, OnEventLoadedCards);

            _ctx.EventDispatcher.AddCmdEventListener(listener1);

            EventListenerCmd listener2 = new EventListenerCmd(MyEventCmd.EVENT_EXITROOM, OnEventLeave);

            _ctx.EventDispatcher.AddCmdEventListener(listener2);
        }
Exemple #5
0
        public StartActor(Context ctx, Controller controller) : base(ctx, controller)
        {
            EventListenerCmd listener1 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_STARTROOT, SetupStartRoot);

            _ctx.EventDispatcher.AddCmdEventListener(listener1);

            EventListenerCmd listener2 = new EventListenerCmd(MyEventCmd.EVENT_UPdATERES, CountdownCb);

            _ctx.EventDispatcher.AddCmdEventListener(listener2);
        }
Exemple #6
0
        public StartActor(Context ctx, Controller controller) : base(ctx, controller)
        {
            EventListenerCmd listener1 = new EventListenerCmd(EventCmd.EVENT_UPDATERES_BEGIN, OnEventUpdateResBegin);

            _ctx.EventDispatcher.AddCmdEventListener(listener1);

            EventListenerCmd listener2 = new EventListenerCmd(EventCmd.EVENT_UPDATERES_END, OnEventUpdateResEnd);

            _ctx.EventDispatcher.AddCmdEventListener(listener2);
        }
Exemple #7
0
        public LoginActor(Context ctx, Controller controller) : base(ctx, controller)
        {
            EventListenerCmd listener1 = new EventListenerCmd(MyEventCmd.EVENT_LOGIN, Login);

            _ctx.EventDispatcher.AddCmdEventListener(listener1);

            EventListenerCmd listener2 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_LOGINPANEL, SetupLoginPanel);

            _ctx.EventDispatcher.AddCmdEventListener(listener2);
        }
Exemple #8
0
        public MyPlayer(Context ctx, GameController controller, uint session) : base(ctx, controller, session)
        {
            EventListenerCmd listener4 = new EventListenerCmd(MyEventCmd.EVENT_PRESSDOWN, OnPressDown);

            _ctx.EventDispatcher.AddCmdEventListener(listener4);

            EventListenerCmd listener5 = new EventListenerCmd(MyEventCmd.EVENT_PRESSUP, OnPressUp);

            _ctx.EventDispatcher.AddCmdEventListener(listener5);

            EventListenerCmd listener6 = new EventListenerCmd(MyEventCmd.EVENT_PRESSLEFT, OnPressLeft);

            _ctx.EventDispatcher.AddCmdEventListener(listener6);

            EventListenerCmd listener7 = new EventListenerCmd(MyEventCmd.EVENT_PRESSRIGHT, OnPressRight);

            _ctx.EventDispatcher.AddCmdEventListener(listener7);
        }
Exemple #9
0
        public GUIRootActor(Context ctx, Controller controller) : base(ctx, controller)
        {
            EventListenerCmd listener1 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_GUIROOT, SetupGuiRoot);

            _ctx.EventDispatcher.AddCmdEventListener(listener1);

            EventListenerCmd listener2 = new EventListenerCmd(MyEventCmd.EVENT_RESTART, OnSendRestart);

            _ctx.EventDispatcher.AddCmdEventListener(listener2);

            EventListenerCmd listener3 = new EventListenerCmd(MyEventCmd.EVENT_GAME_OPENSETTING, OnOpenSetting);

            _ctx.EventDispatcher.AddCmdEventListener(listener3);

            EventListenerCmd listener4 = new EventListenerCmd(MyEventCmd.EVENT_GAME_INVITE, OnInvite);

            _ctx.EventDispatcher.AddCmdEventListener(listener4);
        }
Exemple #10
0
        public RightPlayer(Context ctx, GameService service) : base(ctx, service)
        {
            _upv   = Quaternion.AngleAxis(-90.0f, Vector3.up);
            _uph   = Quaternion.AngleAxis(-180.0f, Vector3.up);
            _downv = Quaternion.AngleAxis(-90.0f, Vector3.up) * Quaternion.AngleAxis(180.0f, Vector3.forward);
            _backv = Quaternion.Euler(-90.0f, -90.0f, 0.0f);

            _ori              = Orient.RIGHT;
            _takeleftoffset   = 0.5f;
            _takebottomoffset = 0.385f;

            _leftoffset   = 0.5f;
            _bottomoffset = 1.7f;

            _leadcardoffset   = new Vector3(0.0f, 0.0f, 0.05f);
            _leadleftoffset   = 0.8f;
            _leadbottomoffset = 0.8f;

            _putbottomoffset = 0.07f - Card.Length / 2.0f;
            _putrightoffset  = 0.55f - Card.Width / 2.0f;

            //
            _hurightoffset  = 0.2f;
            _hubottomoffset = 0.4f;

            // 手
            _rhandinitpos    = new Vector3(4.0f, -1.8f, 0.4f);
            _rhandinitrot    = Quaternion.Euler(0.0f, -90.0f, 0.0f);
            _rhandleadoffset = new Vector3(1.08f, -1.95f, -0.6f);
            _rhandtakeoffset = new Vector3(0.485f, -2.0f, -0.4f);
            _rhandnaoffset   = new Vector3(0.425f, -2.108f, -0.43f);
            _rhandpgoffset   = Vector3.zero;
            _rhandhuoffset   = Vector3.zero;

            _lhandinitpos  = new Vector3(4.0f, -1.8f, 1f);
            _lhandinitrot  = Quaternion.Euler(0.0f, -90.0f, 0.4f);
            _lhandhuoffset = Vector3.zero;


            EventListenerCmd listener1 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_RIGHTPLAYER, OnSetup);

            _ctx.EventDispatcher.AddCmdEventListener(listener1);
        }
Exemple #11
0
        public LeftPlayer(Context ctx, GameService service)
            : base(ctx, service)
        {
            _upv   = Quaternion.AngleAxis(90.0f, Vector3.up);
            _uph   = Quaternion.AngleAxis(0.0f, Vector3.up);
            _downv = Quaternion.AngleAxis(90.0f, Vector3.up) * Quaternion.AngleAxis(180.0f, Vector3.forward);
            _backv = Quaternion.AngleAxis(90.0f, Vector3.up) * Quaternion.AngleAxis(-90.0f, Vector3.right);

            _ori              = Orient.LEFT;
            _takeleftoffset   = 0.5f;
            _takebottomoffset = 0.37f;

            _leftoffset   = 0.5f;
            _bottomoffset = 0.2f;

            _leadcardoffset   = new Vector3(0.0f, 0.0f, -0.05f);
            _leadleftoffset   = 0.8f;
            _leadbottomoffset = 0.8f;

            _putbottomoffset = 0.07f - Card.Length / 2.0f;
            _putrightoffset  = 0.55f - Card.Width / 2.0f;

            // 手
            _rhandinitpos    = new Vector3(-2.0f, -1.8f, 1.6f);
            _rhandinitrot    = Quaternion.Euler(0.0f, 90.0f, 0.0f);
            _rhandtakeoffset = new Vector3(-0.469f, -1.991f, 0.381f);
            _rhandleadoffset = new Vector3(-1.135f, -1.938f, 0.624f);
            _rhandnaoffset   = new Vector3(-0.4195f, -2.143f, 0.4219f);
            _rhandpgoffset   = new Vector3(-0.662f, -2.648f, 0.791f);
            _rhandhuoffset   = Vector3.zero;

            _lhandinitpos  = new Vector3(-2.0f, -1.8f, 1.6f);
            _lhandinitrot  = Quaternion.Euler(0.0f, 90.0f, 0.0f);
            _lhandhuoffset = Vector3.zero;

            EventListenerCmd listener1 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_LEFTPLAYER, OnSetup);

            _ctx.EventDispatcher.AddCmdEventListener(listener1);
        }
Exemple #12
0
        public TopPlayer(Context ctx, GameService service) : base(ctx, service)
        {
            _upv   = Quaternion.AngleAxis(180.0f, Vector3.up);
            _uph   = Quaternion.AngleAxis(90.0f, Vector3.up);
            _downv = Quaternion.AngleAxis(180.0f, Vector3.up) * Quaternion.AngleAxis(180.0f, Vector3.forward);
            _backv = Quaternion.AngleAxis(180.0f, Vector3.up) * Quaternion.AngleAxis(-90.0f, Vector3.right);

            _ori              = Orient.TOP;
            _takeleftoffset   = 0.5f;
            _takebottomoffset = 0.405f - (Card.Length / 2.0f);

            _leftoffset   = 0.5f;
            _bottomoffset = 1.72f;

            _leadcardoffset   = new Vector3(-0.05f, 0.0f, 0.0f);
            _leadleftoffset   = 0.8f;
            _leadbottomoffset = 0.8f;

            _putbottomoffset = 0.1f - Card.Length / 2.0f;
            _putrightoffset  = 0.55f - Card.Width / 2.0f;

            // 手
            _rhandinitpos    = new Vector3(1.6f, -1.8f, 3.0f);
            _rhandinitrot    = Quaternion.Euler(0.0f, 180.0f, 0.0f);
            _rhandleadoffset = new Vector3(0.597f, -1.967f, 1.124f);
            _rhandtakeoffset = new Vector3(0.399f, -2.034f, 0.497f);
            _rhandnaoffset   = new Vector3(0.43f, -2.136f, 0.4299f);
            _rhandpgoffset   = Vector3.zero;
            _rhandhuoffset   = Vector3.zero;

            _lhandinitpos  = new Vector3(1.6f, -1.8f, 3.0f);
            _lhandinitrot  = Quaternion.Euler(0.0f, 180.0f, 0.0f);
            _lhandhuoffset = Vector3.zero;

            EventListenerCmd listener1 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_TOPPLAYER, OnSetup);

            _ctx.EventDispatcher.AddCmdEventListener(listener1);
        }
        public GameController(Context ctx) : base(ctx)
        {
            _systems        = new Entitas.Systems();
            _indexsystem    = new IndexSystem(Contexts.sharedInstance.game);
            _mapsystem      = new MapSystem(Contexts.sharedInstance.game);
            _joinsystem     = new JoinSystem(Contexts.sharedInstance.game);
            _myplayersystem = new MyPlayerSystem(Contexts.sharedInstance.game);
            _systems.Add(_indexsystem)
            .Add(_mapsystem)
            .Add(_joinsystem)
            .Add(_myplayersystem);


            // 4, protocol
            _syncmsg1 = new byte[4];
            NetPack.Packli(_syncmsg1, 0, 1);

            EventListenerCmd listener2 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_MAP, SetupMap);

            _ctx.EventDispatcher.AddCmdEventListener(listener2);

            //EventListenerCmd listener3 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_VIEW, SetupCamera);
            //_ctx.EventDispatcher.AddCmdEventListener(listener3);
        }
Exemple #14
0
        public BottomPlayer(Context ctx, GameService service) : base(ctx, service)
        {
            _upv   = Quaternion.AngleAxis(0.0f, Vector3.up);
            _uph   = Quaternion.AngleAxis(-90.0f, Vector3.up);
            _downv = Quaternion.AngleAxis(180.0f, Vector3.forward);
            _backv = Quaternion.Euler(-25.0f, 0.0f, 0.0f);

            _ori              = Orient.BOTTOM;
            _takeleftoffset   = 0.5f;
            _takebottomoffset = 0.42f;

            _leftoffset   = 0.5f;
            _bottomoffset = 0.2f;

            _leadcardoffset   = new Vector3(0.05f, 0.0f, 0.0f);
            _leadleftoffset   = 0.8f;
            _leadbottomoffset = 0.8f;

            _putbottomoffset = 0.235f - Card.Length / 2.0f;
            _putrightoffset  = 0.25f - Card.Width / 2.0f;

            // 手
            _rhandinitpos     = new Vector3(0.4f, -1.0f, -1.8f);
            _rhandinitrot     = Quaternion.Euler(30.0f, 0.0f, 0.0f);
            _rhanddiuszoffset = new Vector3(0.154f, -1.965f, 0.123f);
            _rhandtakeoffset  = new Vector3(-0.39f, -1.445f, -1.546f);
            _rhandleadoffset  = new Vector3(-0.592f, -1.954f, -1.111f);
            _rhandnaoffset    = new Vector3(-0.413f, -1.633f, -1.456f);
            _rhandpgoffset    = Vector3.zero;
            _rhandhuoffset    = Vector3.zero;

            _lhandinitpos  = new Vector3(0.4f, -1.0f, -1.8f);
            _lhandinitrot  = Quaternion.Euler(30.0f, 0.0f, 0.0f);
            _lhandhuoffset = Vector3.zero;

            EventListenerCmd listener1 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_BOTTOMPLAYER, OnSetup);

            _ctx.EventDispatcher.AddCmdEventListener(listener1);

            EventListenerCmd listener2 = new EventListenerCmd(MyEventCmd.EVENT_PENG, OnSendPeng);

            _ctx.EventDispatcher.AddCmdEventListener(listener2);

            EventListenerCmd listener3 = new EventListenerCmd(MyEventCmd.EVENT_GANG, OnSendGang);

            _ctx.EventDispatcher.AddCmdEventListener(listener3);

            EventListenerCmd listener4 = new EventListenerCmd(MyEventCmd.EVENT_HU, OnSendHu);

            _ctx.EventDispatcher.AddCmdEventListener(listener4);

            EventListenerCmd listener5 = new EventListenerCmd(MyEventCmd.EVENT_GUO, OnSendGuo);

            _ctx.EventDispatcher.AddCmdEventListener(listener5);

            EventListenerCmd listener6 = new EventListenerCmd(MyEventCmd.EVENT_LEAD, OnSendLead);

            _ctx.EventDispatcher.AddCmdEventListener(listener6);

            EventListenerCmd listener7 = new EventListenerCmd(MyEventCmd.EVENT_XUANQUE, OnSendQue);

            _ctx.EventDispatcher.AddCmdEventListener(listener7);

            EventListenerCmd listener8 = new EventListenerCmd(MyEventCmd.EVENT_XUANPAO, OnSendPao);

            _ctx.EventDispatcher.AddCmdEventListener(listener8);
        }