protected override void onInit(SceneProcedure lastProcedure, string intent)
 {
     LayoutTools.SHOW_LAYOUT(LAYOUT_TYPE.LT_DICE);
     // 通知全部角色信息布局全部准备完毕
     mScriptAllCharacterInfo.notifyStartGame();
     mScriptMahjongFrame.notifyStartGame();
 }
Exemple #2
0
    protected override void onInit(SceneProcedure lastProcedure, string intent)
    {
        // 先加载关键帧资源
        mKeyFrameManager.loadAll(false);
        // 预先加载启动视频的背景音乐,因为需要尽量保证在播放视频时视频音效已经加载完
        mAudioManager.loadAudio(SOUND_DEFINE.SD_LOGO_VIDEO);
        // 然后异步加载所有音效
        mAudioManager.loadAll(true);
        // 预加载需要用到的预设
        preloadObject(GameDefine.R_PARTICLE_PREFAB_PATH + GameDefine.SHIELD);
        preloadObject(GameDefine.R_PARTICLE_PREFAB_PATH + GameDefine.TURBO);
        preloadObject(GameDefine.R_SCENE_ITEM_PREFAB_PATH + GameDefine.ITEM_BOX);
        preloadObject(GameDefine.R_SCENE_ITEM_PREFAB_PATH + GameDefine.LANDMINE);
        preloadObject(GameDefine.R_SCENE_ITEM_PREFAB_PATH + GameDefine.MISSILE);
        for (int i = 0; i < GameDefine.ROLE_COUNT; ++i)
        {
            preloadObject(GameDefine.R_CHARACTER_PREFAB_PATH + GameDefine.ROLE_MODEL_NAME[i]);
        }
        // 加载并显示logo布局,也加载全局音效布局
        LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_LOGO, 0);
        LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_GLOBAL_AUDIO, 0);
        LayoutTools.LOAD_NGUI_HIDE(LAYOUT_TYPE.LT_DEBUG_INFO, 25);
        LayoutTools.LOAD_NGUI_ASYNC(LAYOUT_TYPE.LT_STAND_BY, 1, null);
        // 隐藏完毕后跳转到启动视频流程
        CommandGameSceneChangeProcedure cmdProcedure = newCmd(out cmdProcedure, true, true);

        cmdProcedure.mProcedure = PROCEDURE_TYPE.PT_LOGO_START_VIDEO;
        pushDelayCommand(cmdProcedure, mGameScene, mScriptLogo.getFullTime());
    }
    protected override void onInit(SceneProcedure lastProcedure, string intent)
    {
        LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_LOADING, 1);
        mSceneSystem.loadSceneAsync(mRaceSystem.getTrackName(), true, onSceneLoad);

        mSceneInstance = mSceneSystem.getScene <SceneInstance>(mRaceSystem.getTrackName());
    }
Exemple #4
0
    public void showIndex(int index, float time = 0.3f)
    {
        // 设置当前选中的下标,并显示图标
        mShowIndex = index;
        int count = mPropsList.Count;

        for (int i = 0; i < count; ++i)
        {
            mPropsList[i].setSelected(i == mShowIndex);
        }
        // 设置当前起始和目标值
        mStartOffsetValue  = mCurOffsetValue;
        mTargetOffsetValue = -mPropsList[mShowIndex].mControlValueOffset;
        // 默认将范围限定到0-1之间
        MathUtility.clampValue(ref mStartOffsetValue, 0.0f, 1.0f, 1.0f);
        MathUtility.clampValue(ref mTargetOffsetValue, 0.0f, 1.0f, 1.0f);
        // 需要保证起始和目标之间不超过0.5,如果超过0.5则转换范围
        if (Mathf.Abs(mStartOffsetValue - mTargetOffsetValue) > 0.5f)
        {
            MathUtility.clampValue(ref mStartOffsetValue, 0.5f, 1.5f, 1.0f);
            MathUtility.clampValue(ref mTargetOffsetValue, 0.5f, 1.5f, 1.0f);
        }
        // 利用辅助物体开始渐变
        LayoutTools.SCALE_WINDOW_EX(mControlHelper, mControlHelper.getScale(), Vector2.one, time, onHelperScaling, null);
    }
Exemple #5
0
    public override void onGameState()
    {
        int circle = mRaceSystem.getCurGameTrack().mCircleCount;

        for (int i = 0; i < mLapDivided.Length; ++i)
        {
            bool visible = i < circle - 1;
            LayoutTools.ACTIVE_WINDOW(mLapDivided[i], visible);
            if (visible)
            {
                Vector2 iconWindowSize = mLapDivided[i].getWindowSize();
                Vector2 windowPos      = new Vector2(mBackgroundSize.x / 2.0f + iconWindowSize.x / 2.0f, (float)(i + 1) / circle * mBackgroundSize.y);
                LayoutTools.MOVE_WINDOW(mLapDivided[i], translateIconPos(windowPos, mBackgroundSize));
            }
        }
        int aiCount = mRoleSystem.getPlayerCount() - 1;
        int count   = mAI.Length;

        for (int i = 0; i < count; ++i)
        {
            bool visible = i < aiCount;
            LayoutTools.ACTIVE_WINDOW(mAI[i], visible);
            if (visible)
            {
                setPlayerProgress(0.0f, i);
            }
        }
        setPlayerProgress(0.0f, -1);
    }
 public override void onShow(bool immediately, string param)
 {
     LayoutTools.ACTIVE_WINDOW(mTimeCountDown);
     mTimeCountDown.stop();
     mTimeCountDown.play();
     GameTools.PLAY_AUDIO_UI(mTimeCountDown, SOUND_DEFINE.SD_FINISH_COUNT_DOWN);
 }
    protected override void onInit(SceneProcedure lastProcedure, string intent)
    {
        // 从待机流程和选择赛道流程跳转过来,正常显示布局
        if (!lastProcedure.isThisOrParent(PROCEDURE_TYPE.PT_START_SETTING))
        {
            // 设置摄像机的变换
            RoleDisplay roleDisplay = mSceneSystem.getScene <RoleDisplay>(GameDefine.ROLE_DISPLAY);
            GameCamera  mainCamera  = mCameraManager.getMainCamera();
            if (!lastProcedure.isThisOrParent(PROCEDURE_TYPE.PT_START_SELECT_TRACK))
            {
                mainCamera.copyCamera(roleDisplay.mCameraPositionObject0);
                LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_BUTTOM_PROMPT, 9);
            }
            else
            {
                Transform cameraPos0 = roleDisplay.mCameraTransform0;
                ObjectTools.MOVE_OBJECT(mainCamera, mainCamera.getPosition(), cameraPos0.localPosition, 0.5f);
                ObjectTools.ROTATE_OBJECT(mainCamera, mainCamera.getRotation(), cameraPos0.localEulerAngles, 0.5f);
            }
            LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_SELECT_ROLE, 9);
        }
        // 从设置流程跳转过来,立即显示布局
        else
        {
            LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_BUTTOM_PROMPT, 9);
        }
        LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_RETURN, 0);
        // 设置当前选中角色
        CommandStartSceneSelectRole cmd = newCmd(out cmd);

        cmd.mIndex     = mRoleSystem.getSelectedIndex();
        cmd.mPlayAudio = false;
        pushCommand(cmd, mGameScene);
    }
Exemple #8
0
 public override void onReset()
 {
     mVolume = mGameSetting.getCurVolume();
     setVolume(mVolume);
     LayoutTools.MOVE_WINDOW(mUIVolumeRoot, mPosRootStart);
     LayoutTools.ALPHA_WINDOW(mUIVolumeRoot, 0.0f);
 }
 public override void onReset()
 {
     LayoutTools.SCALE_WINDOW(mLeaveRoomButton, Vector2.one);
     LayoutTools.SCALE_WINDOW(mReadyButton, Vector2.one);
     LayoutTools.SCALE_WINDOW(mCancelReadyButton, Vector2.one);
     notifyReady(false);
 }
Exemple #10
0
 //-----------------------------------------------------------------------------------
 protected void onDiceAnimDone(txNGUISpriteAnim window, object userData, bool isBreak)
 {
     LayoutTools.ACTIVE_WINDOW(mDice0);
     LayoutTools.ACTIVE_WINDOW(mDice1);
     // 骰子停留0.2秒后再通知场景
     pushDelayCommand <CommandMahjongSceneNotifyDiceDone>(mGameSceneManager.getCurScene(), 0.2f);
 }
Exemple #11
0
 protected void onArrowEnd(ComponentKeyFrameBase component, object userData, bool breakTremling, bool done)
 {
     LayoutTools.ACTIVE_WINDOW(mLeftArrow, false);
     LayoutTools.ACTIVE_WINDOW(mRightArrow, false);
     LayoutTools.MOVE_WINDOW(mTrackRoot, mTrackRootEndPos, mTrackRootStartPos, 0.25f);
     LayoutTools.ALPHA_WINDOW_EX(mTrackRoot, 1.0f, 0.0f, 0.25f, onArrowAlphaDone);
 }
Exemple #12
0
 public void onRest()
 {
     LayoutTools.ACTIVE_WINDOW(mProp, false);
     LayoutTools.ACTIVE_WINDOW(mLabel, false);
     LayoutTools.ACTIVE_WINDOW(mIcon, false);
     setSelected(false);
 }
Exemple #13
0
    public void showIndex(int index)
    {
        int trackCount = mTrackList.Count;

        for (int i = 0; i < trackCount; ++i)
        {
            mTrackList[i].setSelected(index == i);
        }
        // 选择上一个或者是从第0个切换到了最后一个
        arrowAnim(index - mShowIndex == -1 || index - mShowIndex == mTrackList.Count - 1);
        // 设置当前选中的下标,并显示图标
        mShowIndex = index;
        // 设置当前起始和目标值
        mStartOffsetValue  = mCurOffsetValue;
        mTargetOffsetValue = -mTrackList[mShowIndex].mControlValueOffset;
        // 默认将范围限定到0-1之间
        MathUtility.clampValue(ref mStartOffsetValue, 0.0f, 1.0f, 1.0f);
        MathUtility.clampValue(ref mTargetOffsetValue, 0.0f, 1.0f, 1.0f);
        // 需要保证起始和目标之间不超过0.5,如果超过0.5则转换范围
        if (Mathf.Abs(mStartOffsetValue - mTargetOffsetValue) > 0.5f)
        {
            MathUtility.clampValue(ref mStartOffsetValue, 0.5f, 1.5f, 1.0f);
            MathUtility.clampValue(ref mTargetOffsetValue, 0.5f, 1.5f, 1.0f);
        }
        // 利用辅助物体开始渐变
        LayoutTools.SCALE_WINDOW_EX(mControlHelper, mControlHelper.getScale(), Vector2.one, 0.3f, onHelperScaling, null);
    }
    protected void showPengGang(int index, ACTION_TYPE type, MAHJONG mah)
    {
        int count = 0;

        if (type == ACTION_TYPE.AT_PENG)
        {
            count = 3;
        }
        else if (type == ACTION_TYPE.AT_GANG)
        {
            count = 4;
        }
        else
        {
            return;
        }
        LayoutTools.ACTIVE_WINDOW(mPengGangSingleRoot[index]);
        int    maxCount          = mMahjongWindows[index].Count;
        string mahjongSpriteName = mMahjongPreName + GameDefine.MAHJONG_NAME[(int)mah];

        for (int i = 0; i < maxCount; ++i)
        {
            LayoutTools.ACTIVE_WINDOW(mMahjongWindows[index][i], i < count);
            if (i < count)
            {
                mMahjongWindows[index][i].setSpriteName(mahjongSpriteName);
            }
        }
    }
Exemple #15
0
 public override void enter(StateParam param)
 {
     // 显示瞄准图标,只有玩家自己进入瞄准状态才显示
     if (mPlayer.isType(CHARACTER_TYPE.CT_MYSELF))
     {
         LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_AIMING, 20);
     }
 }
Exemple #16
0
 protected override void onInit(SceneProcedure lastProcedure, string intent)
 {
     LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_MAIN_FRAME, true);
     LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_CHARACTER, true);
     LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_BILLBOARD, true);
     LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_ROOM_MENU, true);
     LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_JOIN_ROOM_DIALOG, true);
 }
 public override void onReset()
 {
     LayoutTools.ACTIVE_WINDOW(mSecondCircle, false);
     LayoutTools.ACTIVE_WINDOW(mThirdCircle, false);
     LayoutTools.ACTIVE_WINDOW(mFourthCircle, false);
     LayoutTools.ACTIVE_WINDOW(mFinishRace, false);
     LayoutTools.ACTIVE_WINDOW(mUnfinishRace, false);
 }
Exemple #18
0
 public override void enter(StateParam param)
 {
     // 显示方向提示界面,只有玩家自己进入瞄准状态才显示
     if (mPlayer.isType(CHARACTER_TYPE.CT_MYSELF))
     {
         LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_DIRECTION_TIPS, 20);
     }
 }
Exemple #19
0
    protected override void onExit(SceneProcedure nextProcedure)
    {
        LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_GAME_ENDING);
        // 清空房间中所有玩家的麻将数据
        MahjongScene mahjongScene = mGameScene as MahjongScene;

        mahjongScene.getRoom().clearAllPlayerMahjongData();
    }
Exemple #20
0
 //--------------------------------------------------------------------------------------------------------------
 public override void setActive(bool active)
 {
     if (active && !LayoutTools.checkStaticPanel(mComponentOwner as txUIObject))
     {
         return;
     }
     base.setActive(active);
 }
Exemple #21
0
 public override void leave()
 {
     // 隐藏方向提示界面
     if (mPlayer.isType(CHARACTER_TYPE.CT_MYSELF))
     {
         LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_DIRECTION_TIPS);
     }
 }
Exemple #22
0
 //---------------------------------------------------------------------------------------------------------
 protected void onDoneScalePanel(ComponentKeyFrameBase component, object userData, bool breakTremling, bool done)
 {
     if (breakTremling)
     {
         return;
     }
     LayoutTools.ACTIVE_WINDOW(mConfirmTextRoot);
 }
 protected override void onInit(SceneProcedure lastProcedure, string intent)
 {
     mLoadedCount = 0;
     foreach (var item in mLoadInfo)
     {
         LayoutTools.LOAD_LAYOUT_ASYNC(item.Key, item.Value.mOrder, onLayoutLoaded);
     }
 }
 protected override void onExit(SceneProcedure nextProcedure)
 {
     // 清空所有角色的所有状态
     mRoleSystem.clearAllPlayerState();
     // 销毁所有比赛角色
     mRoleSystem.destroyAllPlayer();
     LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_SETTLEMENT);
 }
Exemple #25
0
 protected override void onPrepareExit(SceneProcedure nextProcedure)
 {
     base.onPrepareExit(nextProcedure);
     if (nextProcedure.isThisOrParent(PROCEDURE_TYPE.PT_START_SELECT_ROLE))
     {
         LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_SELECT_TRACK);
     }
 }
Exemple #26
0
 protected void onBackgroundHide(ComponentKeyFrameBase component, object userData, bool breakTremling, bool done)
 {
     if (breakTremling)
     {
         return;
     }
     LayoutTools.HIDE_LAYOUT_FORCE(mType);
 }
Exemple #27
0
 protected override void onExit(SceneProcedure nextProcedure)
 {
     LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_MAIN_FRAME);
     LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_CHARACTER);
     LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_BILLBOARD);
     LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_ROOM_MENU);
     LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_JOIN_ROOM_DIALOG);
 }
Exemple #28
0
    //-----------------------------------------------------------------------------------
    protected void onDiceAnimDone(txUISpriteAnim window, object userData, bool isBreak)
    {
        LayoutTools.ACTIVE_WINDOW(mDice0);
        LayoutTools.ACTIVE_WINDOW(mDice1);
        // 骰子停留1秒后再通知场景
        CommandMahjongSceneNotifyDiceDone cmd = mCommandSystem.newCmd <CommandMahjongSceneNotifyDiceDone>(true, true);

        mCommandSystem.pushDelayCommand(cmd, mGameSceneManager.getCurScene(), 2.0f);
    }
 public void onReset()
 {
     LayoutTools.MOVE_WINDOW(mRole, mStartPosition);
     LayoutTools.SCALE_WINDOW(mRole, Vector2.one);
     LayoutTools.ALPHA_WINDOW(mRole, 1.0f);
     LayoutTools.ACTIVE_WINDOW(mRole, false);
     mSelected = -1;
     mHideDone = true;
 }
Exemple #30
0
 public void lerp(PropsItem curItem, PropsItem nextItem, float percent)
 {
     LayoutTools.MOVE_WINDOW(mProp, MathUtility.lerp(curItem.mOriginPosition, nextItem.mOriginPosition, percent));
     LayoutTools.SCALE_WINDOW(mProp, MathUtility.lerp(curItem.mOriginScale, nextItem.mOriginScale, percent));
     mProp.setDepth((int)MathUtility.lerp(curItem.mOriginPropDepth, nextItem.mOriginPropDepth, percent));
     mBackground.setDepth((int)MathUtility.lerp(curItem.mOriginBackgroundDepth, nextItem.mOriginBackgroundDepth, percent));
     mLabel.setDepth((int)MathUtility.lerp(curItem.mOriginLabelDepth, nextItem.mOriginLabelDepth, percent));
     mIcon.setDepth((int)MathUtility.lerp(curItem.mOriginIconDepth, nextItem.mOriginIconDepth, percent));
 }