コード例 #1
0
    void OnSreenAlphaToMax()
    {
        GameMode modeVal = XkGameCtrl.GameModeVal;

        Debug.Log("OnSreenAlphaToMax -> GameMode " + modeVal);

        bool isClearCartoonNpc = true;

        if (!XKTriggerOpenPlayerUI.IsActiveOpenPlayerUI)
        {
            XKPlayerCamera.GetInstanceCartoon().SetActiveCamera(false);
        }

        switch (modeVal)
        {
        case GameMode.DanJiFeiJi:
            XkPlayerCtrl.GetInstanceFeiJi().MakePlayerFlyToPathMark();
            break;

        case GameMode.DanJiTanKe:
            XkPlayerCtrl.GetInstanceTanKe().MakePlayerFlyToPathMark();
            break;

        case GameMode.LianJi:
            if (XkPlayerCtrl.GetInstanceFeiJi() != null)
            {
                XkPlayerCtrl.GetInstanceFeiJi().MakePlayerFlyToPathMark();
            }

            if (XkPlayerCtrl.GetInstanceTanKe() != null)
            {
                XkPlayerCtrl.GetInstanceTanKe().MakePlayerFlyToPathMark();
            }

            if (Network.peerType != NetworkPeerType.Disconnected)
            {
                isClearCartoonNpc = false;
            }

            if (Network.peerType == NetworkPeerType.Client)
            {
                NetCtrl.GetInstance().SendSetScreenDanHeiIsStartGame();
            }
            break;
        }
        DestroyObject(DanHeiTweenAlpha);
        DanHeiTweenAlpha         = ScreenDanHeiObj.AddComponent <TweenAlpha>();
        DanHeiTweenAlpha.enabled = false;
        DanHeiTweenAlpha.from    = 1f;
        DanHeiTweenAlpha.to      = 0f;
        EventDelegate.Add(DanHeiTweenAlpha.onFinished, delegate {
            Invoke("OnSreenAlphaToMin", 0.2f);
        });
        DanHeiTweenAlpha.enabled = true;
        DanHeiTweenAlpha.PlayForward();

        if (isClearCartoonNpc)
        {
            XkGameCtrl.ClearCartoonSpawnNpc();
        }

        if (Network.peerType != NetworkPeerType.Server)
        {
            IsStartGame = true;
        }
        Time.timeScale = 1.0f;
        switch (modeVal)
        {
        case GameMode.DanJiFeiJi:
            XkPlayerCtrl.GetInstanceFeiJi().RestartMovePlayer();
            break;

        case GameMode.DanJiTanKe:
            XkPlayerCtrl.GetInstanceTanKe().RestartMovePlayer();
            break;

        case GameMode.LianJi:
            if (Network.peerType != NetworkPeerType.Server)
            {
                if (Network.peerType != NetworkPeerType.Client)
                {
                    if (XkPlayerCtrl.GetInstanceFeiJi() != null)
                    {
                        XkPlayerCtrl.GetInstanceFeiJi().RestartMovePlayer();
                    }

                    if (XkPlayerCtrl.GetInstanceTanKe() != null)
                    {
                        XkPlayerCtrl.GetInstanceTanKe().RestartMovePlayer();
                    }
                    XKCameraMapCtrl.GetInstance().SetCameraMapState();                     //test
                }
                else
                {
                    //SendServerMovePlayer
                    NetCtrl.GetInstance().SetScreenDanHieStartMovePlayer();
                }
            }
            else
            {
                AddStartMovePlayerCount();
            }
            break;
        }
    }