Beispiel #1
0
    public override void execute()
    {
        JOIN_ROOM_RESULT result = (JOIN_ROOM_RESULT)(mResult.mValue);

        if (result == JOIN_ROOM_RESULT.JRR_SUCC)
        {
            UnityUtility.logInfo("加入房间成功, 房间ID:" + mRoomID);
            // 设置房间号和服务器中的位置
            CharacterMyself myself = mCharacterManager.getMyself();
            CharacterData   data   = myself.getCharacterData();
            data.mRoomID         = mRoomID.mValue;
            data.mServerPosition = (PLAYER_POSITION)mServerPosition.mValue;
            data.mBanker         = mBanker.mValue;

            // 进入麻将场景
            CommandGameSceneManagerEnter cmd = newCmd(out cmd);
            cmd.mSceneType = GAME_SCENE_TYPE.GST_MAHJONG;
            pushCommand(cmd, mGameSceneManager);

            // 进入麻将场景后,创建房间
            MahjongScene mahjongScene = mGameSceneManager.getCurScene() as MahjongScene;
            Room         room         = mahjongScene.createRoom(myself.getCharacterData().mRoomID);
            // 将自己加入房间
            CommandRoomJoin cmdJoin = newCmd(out cmdJoin);
            cmdJoin.mCharacter = myself;
            pushCommand(cmdJoin, room);
        }
        else
        {
            UnityUtility.logInfo("加入房间失败, 原因:" + result);
        }
    }
Beispiel #2
0
    public override void execute()
    {
        if (mLoginRet.mValue == 0)
        {
            // 创建玩家
            CommandCharacterManagerCreateCharacter cmdCreate = newCmd(out cmdCreate);
            cmdCreate.mCharacterType = CHARACTER_TYPE.CT_MYSELF;
            cmdCreate.mName          = bytesToString(mName.mValue, getGB2312());
            cmdCreate.mID            = mPlayerGUID.mValue;
            pushCommand(cmdCreate, mCharacterManager);
            // 设置角色数据
            CharacterMyself myself = mCharacterManager.getMyself();
            CharacterData   data   = myself.getCharacterData();
            data.mMoney = mMoney.mValue;
            data.mHead  = mHead.mValue;

            // 进入到主场景
            CommandGameSceneManagerEnter cmdEnterMain = newCmd(out cmdEnterMain, true, true);
            cmdEnterMain.mSceneType = GAME_SCENE_TYPE.GST_MAIN;
            pushDelayCommand(cmdEnterMain, mGameSceneManager);
        }
        else if (mLoginRet.mValue == 1)
        {
            string info = "账号密码错误!";
            GameUtility.messageOK(info);
            UnityUtility.logInfo(info);
        }
        else if (mLoginRet.mValue == 2)
        {
            string info = "已在其他地方登陆!";
            GameUtility.messageOK(info);
            UnityUtility.logInfo(info);
        }
    }
Beispiel #3
0
    //---------------------------------------------------------------------------------------------------------------------
    protected void onLoginClick(GameObject obj)
    {
        if (!mTestAccount)
        {
            CSLogin login = mSocketManager.createPacket <CSLogin>();
            login.setAccount(mAccountEdit.getText());
            login.setPassword(mPasswordEdit.getText());
            mSocketManager.sendMessage(login);
            // 发送登录消息后显示正在登录的提示框
            LT.ACTIVE_WINDOW(mTipMask);
            mCurTime = 0.0f;
        }
        else
        {
            // 创建玩家
            CommandCharacterManagerCreateCharacter cmdCreate = newCmd(out cmdCreate);
            cmdCreate.mCharacterType = CHARACTER_TYPE.CT_MYSELF;
            cmdCreate.mName          = "测试";
            cmdCreate.mID            = 0;
            pushCommand(cmdCreate, mCharacterManager);
            // 设置角色数据
            CharacterMyself myself = mCharacterManager.getMyself();
            CharacterData   data   = myself.getCharacterData();
            data.mMoney = 100;
            data.mHead  = 1;

            // 进入到主场景
            CommandGameSceneManagerEnter cmdEnterMain = newCmd(out cmdEnterMain, true, true);
            cmdEnterMain.mSceneType = GAME_SCENE_TYPE.GST_MAIN;
            pushDelayCommand(cmdEnterMain, mGameSceneManager);
        }
    }
Beispiel #4
0
    public override void execute()
    {
        if (mLoginRet.mValue == 0)
        {
            // 创建玩家
            CommandCharacterManagerCreateCharacter cmdCreate = mCommandSystem.newCmd <CommandCharacterManagerCreateCharacter>();
            cmdCreate.mCharacterType = CHARACTER_TYPE.CT_MYSELF;
            cmdCreate.mName          = BinaryUtility.bytesToString(mName.mValue, Encoding.UTF8);
            cmdCreate.mID            = mPlayerGUID.mValue;
            mCommandSystem.pushCommand(cmdCreate, mCharacterManager);
            // 设置角色数据
            CharacterMyself myself = mCharacterManager.getMyself();
            CharacterData   data   = myself.getCharacterData();
            data.mMoney = mMoney.mValue;
            data.mHead  = mHead.mValue;

            // 进入到主场景
            CommandGameSceneManagerEnter cmdEnterMain = mCommandSystem.newCmd <CommandGameSceneManagerEnter>(true, true);
            cmdEnterMain.mSceneType = GAME_SCENE_TYPE.GST_MAIN;
            mCommandSystem.pushDelayCommand(cmdEnterMain, mGameSceneManager);
        }
        else if (mLoginRet.mValue == 1)
        {
            UnityUtility.logInfo("账号密码错误!");
        }
        else if (mLoginRet.mValue == 2)
        {
            UnityUtility.logInfo("已在其他地方登陆!");
        }
    }
    protected override void onInit(SceneProcedure lastProcedure, string intent)
    {
        LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_MAIN_FRAME);
        LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_CHARACTER);
        LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_BILLBOARD);
        LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_ROOM_MENU);

        // 显示角色信息
        CharacterMyself myself = mCharacterManager.getMyself();

        if (myself != null)
        {
            CharacterData data = myself.getCharacterData();
            mScriptCharacter.setCharacterInfo(data.mHead, data.mName, data.mGUID, data.mMoney);
        }
    }
    protected override void onInit(SceneProcedure lastProcedure, string intent)
    {
        // 显示布局
        LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_ALL_CHARACTER_INFO);
        LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_MAHJONG_BACK_FRAME);
        LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_MAHJONG_FRAME);

        // 通知房间开始等待玩家加入
        MahjongScene mahjongScene = mGameScene as MahjongScene;

        mahjongScene.getRoom().notifyStartWait();

        // 设置显示房间号
        CharacterMyself myself = mCharacterManager.getMyself();

        mScriptMahjongFrame.setRoomID(myself.getCharacterData().mRoomID);
        mScriptMahjongFrame.notifyInfo("正在等待其他玩家准备");
    }