Ejemplo n.º 1
0
    //-------------------------------------------------------------------------
    public override void init()
    {
        Init            = false;
        CacheDesktopKey = "CacheDesktopData_" + Entity.Guid;

        DesktopConfigData = new Ps.DesktopConfigData();
        DesktopConfigData.desktop_etguid       = Entity.Guid;
        DesktopConfigData.seat_num             = 6;
        DesktopConfigData.is_vip               = false;
        DesktopConfigData.desktop_waitwhile_tm = 60;
        MapAllPlayer1 = new Dictionary <uint, Entity>();
        MapAllPlayer  = new Dictionary <string, Entity>();

        byte index = 0;

        AllSeat = new SeatInfo[DesktopConfigData.seat_num];
        foreach (var i in AllSeat)
        {
            SeatInfo seat_info = new SeatInfo();
            seat_info.index           = index;
            seat_info.et_player_rpcid = 0;
            seat_info.et_playermirror = null;
            AllSeat[index]            = seat_info;
            index++;
        }

        DesktopInfo = new DesktopInfo();
        DesktopInfo.desktop_etguid   = Entity.Guid;
        DesktopInfo.seat_num         = 6;
        DesktopInfo.desktop_tableid  = 1;
        DesktopInfo.is_vip           = false;
        DesktopInfo.list_seat_player = new List <DesktopPlayerInfo>();
        DesktopInfo.all_player_num   = 0;
        DesktopInfo.seat_player_num  = 0;

        QueAoIEvent = new Queue <_tAoIEvent>();
        QuePlayerId = new Queue <byte>();
        MaxPlayerId = 0;
        for (int i = 0; i < 50; i++)
        {
            QuePlayerId.Enqueue(++MaxPlayerId);
        }

        TbDataRoom._eRoomType room_type = TbDataRoom._eRoomType.RT_Tenfold;
        bool           fish_mustdie     = true;
        bool           is_single        = false;
        float          pumping_rate     = 1f;
        string         path_fishlord    = Path.Combine(ServerPath.getPathMediaRoot(), "Fishing\\FishLord\\");
        string         path_route       = Path.Combine(ServerPath.getPathMediaRoot(), "Fishing\\Route\\");
        ILogicListener listener         = new LogicListener(this);

        LogicScene = new CLogicScene();
        LogicScene.create(1, 1.0f, is_single, fish_mustdie, listener, pumping_rate, _getRateList(room_type),
                          CellApp.Instance.jsonCfg.json_packet_list,
                          CellApp.Instance.jsonCfg.route_json_packet_list);
    }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
        public override void init()
        {
            EbLog.Note("ClientPlayerDesktop.init()");

            defNodeRpcMethod <DesktopResponse>(
                (ushort)MethodType.s2cPlayerDesktopResponse, s2cPlayerDesktopResponse);
            defNodeRpcMethod <DesktopNotify>(
                (ushort)MethodType.s2cPlayerDesktopNotify, s2cPlayerDesktopNotify);

            Entity et_app = EntityMgr.findFirstEntityByType <EtApp>();

            CoApp = et_app.getComponent <ClientApp <DefApp> >();
            Entity et_player = EntityMgr.findFirstEntityByType <EtPlayer>();

            CoPlayer = et_player.getComponent <ClientPlayer <DefPlayer> >();

            DesktopConfigData      = new DesktopConfigData();
            MapEtActorMirrorByGuid = new Dictionary <string, Entity>();

            mMapAoIEvent[(byte)_eAoIEvent.SceneBroadcast] = onAoIEventSceneBroadcast;
        }
Ejemplo n.º 3
0
        //-------------------------------------------------------------------------
        public override void handleEvent(object sender, EntityEvent e)
        {
            if (e is EvUiClickShop)
            {
                var ev = (EvUiClickShop)e;

                // 点击主界面商城
            }
            else if (e is EvUiClickFriend)
            {
                var ev = (EvUiClickFriend)e;

                // 点击主界面好友
            }
            else if (e is EvUiClickMsg)
            {
                var ev = (EvUiClickMsg)e;

                // 点击主界面消息
            }
            else if (e is EvUiClickHelp)
            {
                var ev = (EvUiClickHelp)e;

                // 点击主界面帮助
            }
            else if (e is EvUiClickEdit)
            {
                var ev = (EvUiClickEdit)e;

                // 点击主界面编辑
            }
            else if (e is EvUiClickLogin)
            {
                var ev = (EvUiClickLogin)e;

                EbLog.Note("ClientPlayer.handleEvent() 响应点击登陆按钮消息");

                // 点击主界面登陆
                CoApp.CoNetMonitor.disconnect();
            }
            else if (e is EvUiClickPlayNow)
            {
                var ev = (EvUiClickPlayNow)e;

                // 点击主界面立即玩
                //requestPlayNow();
            }
            //else if (e is EvUiClickCreateDeskTop)
            //{
            //    var ev = (EvUiClickCreateDeskTop)e;

            //    // 请求创建私人牌桌
            //    int seat_num = ev.seat_num;
            //    PrivateDesktopCreateInfo desktop_createinfo;
            //    desktop_createinfo.seat_num = seat_num;
            //    desktop_createinfo.desktop_tableid = ev.desk_topinfo_id;
            //    desktop_createinfo.is_vip = CoActor.Def.mPropIsVIP.get();

            //    requestCreatePrivateDesktop(desktop_createinfo);
            //}
            else if (e is EvUiClickExitDesk)
            {
                // 点击离开桌子
                requestLeaveDesktop();
            }
            //else if (e is EvUiClickEnterDesktop)
            //{
            //    requestEnterDesktopAny();
            //}
            //else if (e is EvUiClickGetSelfPlayerInfo)
            //{
            //    var ev = (EvUiClickGetSelfPlayerInfo)e;

            //    // 点击主界面玩家信息
            //}
            //else if (e is EvUiClickGetPlayerProfile)
            //{
            //    var ev = (EvUiClickGetPlayerProfile)e;
            //    requestGetPlayerInfoOther(ev.player_etguid);
            //    //requestGetPlayerInfo(ev.player_etguid, _eRequestPlayerInfoReason.PlayerProfile);
            //}
            else if (e is EvUiClickChangePlayerNickName)
            {
                // 改昵称
                var ev = (EvUiClickChangePlayerNickName)e;

                requestChangeNickName(ev.new_name);
            }
            else if (e is EvUiClickChangePlayerIndividualSignature)
            {
                // 改签名
                var ev = (EvUiClickChangePlayerIndividualSignature)e;

                requestChangeIndividualSignature(ev.new_individual_signature);
            }
            else if (e is EvUiClickChangePlayerProfileSkin)
            {
                // 换肤
                var ev = (EvUiClickChangePlayerProfileSkin)e;
                requestChangePlayerProfileSkin(ev.skin_id);
            }
            else if (e is EvUiClickRefreshIPAddress)
            {
                // 刷新IP所在地
                requestRefreshIpAddress();
            }
            else if (e is EvUiReportFriend)
            {
                // 举报好友
                var              ev          = (EvUiReportFriend)e;
                string           et_guid     = ev.friend_etguid;
                ReportPlayerType report_type = ev.report_type;
                requestReprotPlayer(et_guid, report_type);
            }
            else if (e is EvUiInviteFriendPlayTogether)
            {
                // 邀请好友一起玩
                var ev = (EvUiInviteFriendPlayTogether)e;
                DesktopConfigData desktop_configdata = CoPlayerDesktop.DesktopConfigData;

                if (desktop_configdata != null && !string.IsNullOrEmpty(desktop_configdata.desktop_etguid))
                {
                    requestInvitePlayerEnterDesktop(ev.friend_guid, desktop_configdata.desktop_etguid,
                                                    0, 0, CoPlayerDesktop.getPlayerCount(), desktop_configdata.seat_num);
                }
            }
            else if (e is EvUiClickChipTransaction)
            {
                // 点击送筹码
                var ev = (EvUiClickChipTransaction)e;

                if (CoActor.Def.PropGold.get() < 100000)
                {
                    //FloatMsgInfo f_info;
                    //f_info.msg = "筹码不足10万,不能发送!";
                    //f_info.color = Color.red;
                    //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info);
                }
                else
                {
                    //UiMbChipTransaction chip_transaction = UiMgr.Instance.createUi<UiMbChipTransaction>(_eUiLayer.MessgeBox);
                    //chip_transaction.setChipTransactionInfo(CoActor.Def.mPropChip.get(), CoActor.Def.mPropChip.get(),
                    //    100000, CoPlayerFriend.getFriendItem(ev.send_target_etguid));
                }
            }
            else if (e is EvUiCreateMainUi)
            {
                createMainUi();
            }
            else if (e is EvUiCreateExchangeChip)
            {
                // 创建换钱UI
                //UiMbExchangeChip chip_transaction = UiMgr.Instance.createUi<UiMbExchangeChip>(_eUiLayer.MessgeBox);
                //chip_transaction.setExchangeInfo(CoActor.Def.PropGold.get(), CoActor.Def.PropGold.get(), 100);
            }
            else if (e is EvUiRequestGetRankPlayerInfo)
            {
                // 请求排行榜玩家信息
                var ev = (EvUiRequestGetRankPlayerInfo)e;
                requestGetPlayerInfoOther(ev.player_etguid);
            }
            else if (e is EvUiRequestPlayerInfoOther)
            {
                // 请求其他玩家详细信息
                var ev = (EvUiRequestPlayerInfoOther)e;
                requestGetPlayerInfoOther(ev.player_etguid);
            }
        }