/// <summary>
        /// 分配得彩数量信息.
        /// </summary>
        public void FenPeiDeCaiVal(bool isPlayerXuBi)
        {
            int   coinStart        = XKGlobalData.GetInstance().m_CoinToCard *XKGlobalData.GameNeedCoin;
            float xuBiChuPiaoLvTmp = isPlayerXuBi == true ? XuBiChuPiaoLv : 1f;

            if (isPlayerXuBi)
            {
                //玩家续币积累到预支彩票池的彩票数量.
                int jiLeiToYuZhiCaiPiaoChiVal = (int)(coinStart * XuBiChuPiaoLv);
                XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameYuZhiCaiPiaoData.AddYuZhiCaiPiao(jiLeiToYuZhiCaiPiaoChiVal);
            }

            coinStart     = (int)(coinStart * xuBiChuPiaoLvTmp);
            ZhanCheDeCai += (int)(coinStart * ZhanCheChuPiaoLv);
            int suiJiDaoJuDeCaiFenPei = (int)(coinStart * SuiJiDaoJuChuPiaoLv);

            if (suiJiDaoJuDeCaiFenPei < 1)
            {
                //至少给随机道具分配一张彩票.
                suiJiDaoJuDeCaiFenPei = 1;
            }
            SuiJiDaoJuDeCai += suiJiDaoJuDeCaiFenPei;
            JPBossDeCai     += (int)(coinStart * JPBossChuPiaoLv);
            Debug.Log("Unity: FenPeiDeCaiVal -> coinStart == " + coinStart
                      + ", ZhanCheDeCai == " + ZhanCheDeCai
                      + ", SuiJiDaoJuDeCai == " + SuiJiDaoJuDeCai
                      + ", JPBossDeCai == " + JPBossDeCai
                      + ", isPlayerXuBi ==== " + isPlayerXuBi);
        }
    void ResetFactoryInfo()
    {
        ResetPlayerCoinCur();
        XKGlobalData.GameNeedCoin = 1;
        XKGlobalData.GameDiff     = "1";
        XKGlobalData.IsFreeMode   = false;

        HandleJsonObj.WriteToFileXml(FileName, "START_COIN", XKGlobalData.GameNeedCoin.ToString());
        HandleJsonObj.WriteToFileXml(FileName, "GAME_DIFFICULTY", "1");
        HandleJsonObj.WriteToFileXml(FileName, "GAME_MODE", "1");

        //GameAudioVolume = 7;
        //GameAudioVolumeLB.text = GameAudioVolume.ToString();
        //HandleJsonObj.WriteToFileXml(FileName, "GameAudioVolume", "7");
        //XKGlobalData.GameAudioVolume = GameAudioVolume;

        InitCoinStartLabel();
        InitGameDiffDuiGou();
        InitGameModeDuiGou();
        SetPrintCaiPiaoUI(true);
        SetCoinToCardIndo(20);
        XKGlobalData.GetInstance().ResetTotalInsertCoins();
        XKGlobalData.GetInstance().ResetTotalOutPrintCards();
        XKGlobalData.GetInstance().ResetZhanCheCaiChi();
        XKGlobalData.GetInstance().ResetDaoJuCaiChi();
        XKGlobalData.GetInstance().ResetJPBossCaiChi();
        XKGlobalData.GetInstance().ResetYuZhiCaiChi();
        ResetCaiPiaoPrintState();
    }
    /// <summary>
    /// 是否可以复活玩家.
    /// </summary>
    public bool GetIsFuHuoPlayer()
    {
        //if (pcvr.GetInstance().m_TVGamePayType == SSGamePayUICtrl.TVGamePayState.MiGuApk)
        //{
        //    //移动咪咕平台.
        //}
        //else
        //{
        //    //其它平台.
        //    return true;
        //}

        if (m_FuHuoCiShuCom == null)
        {
            UnityLogWarning("ShowGameFuHuoCiShiInfo -> m_FuHuoCiShuCom was null");
            return(false);
        }

        bool isFuHuoPlayer = false;
        int  jiHuoCiShu    = XKGlobalData.GetInstance().m_JiHuoCiShu;
        int  fuHuoCiShu    = m_FuHuoCiShuCom.m_FuHuoCiShu - jiHuoCiShu;

        if (fuHuoCiShu > 0)
        {
            isFuHuoPlayer = true;
        }
        else
        {
            isFuHuoPlayer = false;
        }
        return(isFuHuoPlayer);
    }
    /// <summary>
    /// 设置是否打印彩票.
    /// </summary>
    void SetPrintCaiPiaoUI(bool isPrintCaiPiao)
    {
        m_CaiPiaoShi.SetActive(isPrintCaiPiao);
        m_CaiPiaoFou.SetActive(!isPrintCaiPiao);

        XKGlobalData.GetInstance().SetIsPrintCaiPiao(isPrintCaiPiao);
    }
Example #5
0
    public void ShowZhunXingTeXiao()
    {
        if (gameObject.activeSelf || IsShowZhunXingTX)
        {
            return;
        }
        IsShowZhunXingTX = true;

        if (XkGameCtrl.GetInstance().IsCartoonShootTest)
        {
            IsOverTeXiaoZhunXing = true;
            return;
        }

        Debug.Log("ShowZhunXingTeXiao...");
        if (!XkGameCtrl.IsActivePlayerOne)
        {
            ZhunXingArray[0].SetActive(false);
            ZhunXingArray[1].SetActive(false);
        }

        if (!XkGameCtrl.IsActivePlayerTwo)
        {
            ZhunXingArray[2].SetActive(false);
            ZhunXingArray[3].SetActive(false);
        }
        gameObject.SetActive(true);
        XKGlobalData.GetInstance().PlayAudioZhunXingTX();
    }
    void InitPrintCaiPiaoUI()
    {
        bool isPrintCaiPiao = XKGlobalData.GetInstance().IsPrintCaiPiao;

        m_CaiPiaoShi.SetActive(isPrintCaiPiao);
        m_CaiPiaoFou.SetActive(!isPrintCaiPiao);
    }
    public void ShowFinishTaskInfo()
    {
        if (IsShowFinishTask)
        {
            return;
        }
        IsShowFinishTask = true;
        DanYaoInfoCtrl.GetInstanceOne().HiddenPlayerDanYaoInfo();
        DanYaoInfoCtrl.GetInstanceTwo().HiddenPlayerDanYaoInfo();
        ZhunXingCtrl.GetInstanceOne().SetActiveZhunXingObj(false);
        ZhunXingCtrl.GetInstanceTwo().SetActiveZhunXingObj(false);
        CoinPlayerCtrl.GetInstanceOne().HiddenPlayerCoin();
        CoinPlayerCtrl.GetInstanceTwo().HiddenPlayerCoin();
        YouLiangAddCtrl.GetInstance().HiddenYouLiangAdd();
        YouLiangCtrl.GetInstance().HiddenYouLiang();
        JiFenZongJieMianObj.SetActive(true);

        if (Network.peerType == NetworkPeerType.Server)
        {
            ScreenDanHeiCtrl.GetInstance().OpenPlayerUI();
            if (GameOverCtrl.IsShowGameOver)
            {
                GameOverObj.SetActive(true);
            }
            else
            {
                FinishTaskObj.SetActive(true);
            }
            return;
        }
        FinishTaskObj.SetActive(true);
        XKGlobalData.GetInstance().PlayAudioRenWuOver();
    }
    public void ShowGameOver(int key = 0)
    {
        if (IsShowGameOver)
        {
            return;
        }
        IsShowGameOver = true;
        GameOverObj.SetActive(true);

        //if (pcvr.bIsHardWare) {
        //	MyCOMDevice.GetInstance().ForceRestartComPort();
        //}

        switch (key)
        {
        case 0:
            XKGlobalData.GetInstance().PlayAudioGameOver();
            Invoke("HiddenGameOver", 3f);
            //MakeServerShowGameOver();
            break;

        default:
            Invoke("DelayLoadingGameMovie", 5f);
            break;
        }
    }
    IEnumerator CheckPlayerCountLoop()
    {
        bool isStopCheck = false;

        do
        {
            if (Network.peerType == NetworkPeerType.Server)
            {
                if (PlayerCount >= Network.connections.Length)
                {
                    isStopCheck = true;
                    gameObject.SetActive(false);
                    NetCtrl.GetInstance().HandleLoadingGameHiddenLoadingGame();
                    XkPlayerCtrl.GetInstanceCartoon().DelayMoveCartoonCamera();
                    XKGlobalData.GetInstance().PlayGuanKaBeiJingAudio();
                    yield break;
                }
            }
            else
            {
                if (IsHiddenLoadingGame)
                {
                    isStopCheck = true;
                    gameObject.SetActive(false);
                    XkPlayerCtrl.GetInstanceCartoon().DelayMoveCartoonCamera();
                    XKGlobalData.GetInstance().PlayGuanKaBeiJingAudio();
                    yield break;
                }
            }
            yield return(new WaitForSeconds(0.1f));
        } while (!isStopCheck);
    }
    // Use this for initialization
    void Start()
    {
        MovieRender = GetComponent <Renderer>();
        if (XKGlobalData.GetInstance() != null)
        {
            AudioListener.volume = (float)XKGlobalData.GameAudioVolume / 10f;
        }

        _instance = this;
        XkGameCtrl.ResetIsLoadingLevel();
        pcvr.CloseGunZhenDongDengJi();
        PlayerIPInfo = Network.player.ipAddress;
//		TimeLast = Time.realtimeSinceStartup;
        GameTextType gameTextVal = XKGlobalData.GetGameTextMode();

        //gameTextVal = GameTextType.English; //test.
        switch (gameTextVal)
        {
        case GameTextType.Chinese:
            TextureMv = TextureMv_Ch;
            break;

        case GameTextType.English:
            TextureMv = TextureMv_En;
            break;
        }

        if (AudioListCtrl.GetInstance() != null)
        {
            AudioListCtrl.GetInstance().CloseGameAudioBJ();
        }
        Cursor.visible = pcvr.bIsHardWare;
        LoadingGameCtrl.ResetLoadingInfo();
        Time.timeScale = 1.0f;
        CheckClientPortMovieInfo(1);
        AudioManager.Instance.SetParentTran(null);
        GameOverCtrl.IsShowGameOver = false;

        if (!IsTestLJGame)
        {
            IsActivePlayer = true;
            if (IsTestXiaoScreen)
            {
                Screen.SetResolution((int)(XkGameCtrl.ScreenWidth / 4), (int)(XkGameCtrl.ScreenHeight / 4), false);                 //test
            }
        }

        QualitySettings.SetQualityLevel((int)QualityLevelEnum.Fast);
        AudioSourceObj = transform.GetComponent <AudioSource>();
        Invoke("DelayResetIsLoadingLevel", 5f);
        CountMovie++;
        if (CountMovie == 1 && IsOpenVR)
        {
            Invoke("DelayPlayMovie", 3f);
        }
        else
        {
            PlayMovie();
        }
    }
Example #11
0
    void ClickStartBtFourEvent(pcvr.ButtonState state)
    {
        if (XkGameCtrl.IsActivePlayerFour)
        {
            return;
        }

        if (!StartBtObj.activeSelf)
        {
            return;
        }

        if (GameOverCtrl.IsShowGameOver)
        {
            return;
        }
        XKGlobalData.GetInstance().PlayStartBtAudio();
        SubCoinPlayerFour();
        StartBtObj.SetActive(false);
        XkGameCtrl.SetActivePlayerFour(true);
        ActiveZhanDouObj();

        if (XKGlobalData.GameVersionPlayer != 0)
        {
            XKGlobalData.CoinPlayerTwo = XKGlobalData.CoinPlayerFour;
        }
    }
Example #12
0
    public void MoveIntoStageUI()
    {
        if (StageCtrlObj.activeSelf)
        {
            return;
        }
        TweenPosition twPos = StageObj.GetComponent <TweenPosition>();

        if (twPos != null)
        {
            twPos.enabled = false;
            DestroyObject(twPos);
        }

        StageUI.mainTexture = StageUIArray[StageCount];
        twPos                   = StageObj.AddComponent <TweenPosition>();
        twPos.from              = new Vector3(900f, 0f, 0f);
        twPos.to                = new Vector3(0f, 0f, 0f);
        twPos.duration          = TimeStage;
        transform.localPosition = twPos.from;
        StageObj.SetActive(true);
        StageCtrlObj.SetActive(true);
        twPos.PlayForward();
        StageCount++;
        if (StageCount >= StageUIArray.Length)
        {
            StageCount = 0;
        }

        XKGlobalData.GetInstance().PlayAudioStage1();
        StopCoroutine(ShowJinGongUI());
        StartCoroutine(ShowJinGongUI());
    }
    /// <summary>
    /// 开始打印彩票.
    /// </summary>
    internal void StartPrintPlayerCaiPiao(PlayerEnum indexPlayer, int caiPiao)
    {
        Debug.Log("pcvr::StartPrintPlayerCaiPiao -> indexPlayer == " + indexPlayer + ", caiPiao == " + caiPiao
                  + ", time == " + Time.time);
        if (bIsHardWare && mPcvrTXManage != null)
        {
            int indexVal = (int)indexPlayer;
            if (indexVal < 1 || indexVal > 3)
            {
                Debug.LogWarning("StartPrintPlayerCaiPiao -> indexVal was wrong! indexVal ==== " + indexVal);
                return;
            }

            if (IsOpenDelayPrintPlayerCaiPiao[indexVal - 1] == false)
            {
                pcvrTXManage.CaiPiaoJi indexCaiPiaoJi = (pcvrTXManage.CaiPiaoJi)(indexVal - 1);
                if (mPcvrTXManage.GetIsCanPrintCaiPiao(indexCaiPiaoJi) == true)
                {
                    pcvrTXManage.CaiPiaoPrintCmd cmd = pcvrTXManage.CaiPiaoPrintCmd.BanPiaoPrint;
                    if (XKGlobalData.GetInstance().m_CaiPiaoPrintState == XKGlobalData.CaiPiaoPrintState.QuanPiao)
                    {
                        cmd = pcvrTXManage.CaiPiaoPrintCmd.QuanPiaoPrint;
                    }
                    mPcvrTXManage.SetCaiPiaoPrintCmd(cmd, indexCaiPiaoJi, caiPiao);
                }
                else
                {
                    StartCoroutine(DelayCheckPrintPlayerCaiPiao(indexPlayer, caiPiao));
                }
            }
        }
    }
Example #14
0
    void ClickStartBtOneEvent(ButtonState state)
    {
        if (Time.realtimeSinceStartup - TimeValNet < MaxTimeNet)
        {
            return;
        }

        if (GameTypeCtrl.PlayerPCState != PlayerEnum.PlayerOne)
        {
            return;
        }

        if (XkGameCtrl.IsActivePlayerOne)
        {
            return;
        }

        if (!StartBtObj.activeSelf)
        {
            return;
        }

        if (GameOverCtrl.IsShowGameOver)
        {
            return;
        }
        XKGlobalData.GetInstance().PlayStartBtAudio();
        SubCoinPlayerOne();
        StartBtObj.SetActive(false);
        XkGameCtrl.SetActivePlayerOne(true);
    }
    void UpdateCaiPiaoPrintState()
    {
        XKGlobalData.CaiPiaoPrintState type = XKGlobalData.GetInstance().m_CaiPiaoPrintState;
        switch (type)
        {
        case XKGlobalData.CaiPiaoPrintState.BanPiao:
        {
            type = XKGlobalData.CaiPiaoPrintState.QuanPiao;
            break;
        }

        case XKGlobalData.CaiPiaoPrintState.QuanPiao:
        {
            type = XKGlobalData.CaiPiaoPrintState.BanPiao;
            break;
        }
        }
        XKGlobalData.GetInstance().SetCaiPiaoPrintState(type);

        if (m_CaiPiaoBanPiao != null)
        {
            m_CaiPiaoBanPiao.SetActive(type == XKGlobalData.CaiPiaoPrintState.BanPiao ? true : false);
        }

        if (m_CaiPiaoQuanPiao != null)
        {
            m_CaiPiaoQuanPiao.SetActive(type == XKGlobalData.CaiPiaoPrintState.QuanPiao ? true : false);
        }
    }
        /// <summary>
        /// 判断是否达到某种得彩类型的出彩条件.
        /// </summary>
        public bool GetIsChuCaiPiaoByDeCaiState(DeCaiState type)
        {
            bool  isChuPiao       = false;
            int   coinToCaiPiao   = XKGlobalData.GetInstance().m_CoinToCard *XKGlobalData.GameNeedCoin;
            float chuPiaoTiaoJian = 0f;
            int   deCaiVal        = -1;

            switch (type)
            {
            case DeCaiState.ZhanChe:
            {
                chuPiaoTiaoJian = ZhanCheChuPiaoTiaoJian;
                deCaiVal        = ZhanCheDeCai;
                break;
            }

            case DeCaiState.SuiJiDaoJu:
            {
                chuPiaoTiaoJian = SuiJiDaoJuChuPiaoTiaoJian;
                deCaiVal        = SuiJiDaoJuDeCai;
                break;
            }

            case DeCaiState.JPBoss:
            {
                chuPiaoTiaoJian = JPBossChuPiaoTiaoJian;
                deCaiVal        = JPBossDeCai;
                break;
            }
            }

            int chuCaiVal = (int)(coinToCaiPiao * chuPiaoTiaoJian);

            if (XkGameCtrl.GetInstance().m_CaiPiaoMode == XkGameCtrl.CaiPiaoModeSuanFa.GuDing &&
                XkPlayerCtrl.GetInstanceFeiJi() != null)
            {
                switch (type)
                {
                case DeCaiState.ZhanChe:
                {
                    chuCaiVal = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GuDingBanCaiPiaoData.ZhanCheDeCai;
                    break;
                }

                case DeCaiState.JPBoss:
                {
                    chuCaiVal = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GuDingBanCaiPiaoData.GetJPBossChuPiaoTiaoJian();
                    break;
                }
                }
            }

            if (deCaiVal >= chuCaiVal)
            {
                isChuPiao = true;
                //Debug.Log("Unity: GetIsChuCaiPiaoBy -> the type is can shuCaiPiao! type ============ " + type);
            }
            return(isChuPiao);
        }
Example #17
0
 public void StartPlayBossLaiXi()
 {
     //Debug.Log("Unity:"+"StartPlayBossLaiXi...");
     //BossZuDangCtrl.GetInstance().SetIsActiveBossZuDang(true);
     TimeLastBossLX = Time.time;
     XKGlobalData.GetInstance().PlayAudioBossLaiXi();
     gameObject.SetActive(true);
 }
Example #18
0
 void DelayActiveJiFenJieMian()
 {
     if (GameTimeBossCtrl.GetInstance().GetTimeBossResidual() > 0)
     {
         XKGlobalData.GetInstance().PlayAudioBossShengLi();
     }
     JiFenJieMianCtrl.GetInstance().ActiveJiFenJieMian();
 }
Example #19
0
 public void SetActiveYouLiangFlash(bool isActive)
 {
     IsActiveYouLiangFlash = isActive;
     YouLiangFlashObj.SetActive(isActive);
     if (!isActive)
     {
         XKGlobalData.GetInstance().StopAudioRanLiaoJingGao();
     }
 }
Example #20
0
 public void ShowXunZhangBJXue()
 {
     if (XunZhangBJ.activeSelf)
     {
         return;
     }
     XunZhangBJ.SetActive(true);
     XKGlobalData.GetInstance().PlayAudioXunZhangZP();
 }
Example #21
0
 void ShowPlayerKillNpcNum()
 {
     if (KillNpcObj.activeSelf)
     {
         return;
     }
     KillNpcObj.SetActive(true);
     XKGlobalData.GetInstance().PlayAudioJiFenGunDong();
     Invoke("StopKillNpcNumCartoon", TimeDelayVal);
 }
Example #22
0
    void MoveYouLiangMarkOnCompelteITween()
    {
//		Debug.Log("Unity:"+"MoveYouLiangMarkOnCompelteITween...");
        YouLiangMark.SetActive(false);
        XKGlobalData.GetInstance().PlayJiaYouBaoZhaAudio();
        GameObject obj = (GameObject)Instantiate(ExplodeObj, YouLiangMark.transform.position, YouLiangMark.transform.rotation);

        XkGameCtrl.CheckObjDestroyThisTimed(obj);
        YouLiangAddCtrl.GetInstance().AddPlayerYouLiangDian();
    }
Example #23
0
    IEnumerator ShowJinGongUI()
    {
        yield return(new WaitForSeconds(1.5f));

        JinGongObj.SetActive(true);
        XKGlobalData.GetInstance().PlayAudioStage2();
        yield return(new WaitForSeconds(1f));

        JinGongObj.SetActive(false);
        MoveOutStageUI();
    }
 /// <summary>
 /// 初始化弹幕信息.
 /// </summary>
 void InitDanMuInfo()
 {
     if (XKGlobalData.GetInstance().m_MoRenDanMuInfo != XKGlobalData.GetInstance().m_DanMuInfo)
     {
         m_DanMuLabel.text = XKGlobalData.GetInstance().m_DanMuInfo;
     }
     else
     {
         m_DanMuLabel.text = XKGlobalData.GetInstance().m_MoRenDanMuInfo;
     }
 }
 /// <summary>
 /// 设置弹幕信息.
 /// </summary>
 void SetDanMuInfo(string info)
 {
     if (info.Length > 0 && info.Length <= 10)
     {
         XKGlobalData.GetInstance().SetDanMuInfo(info);
     }
     else
     {
         //UnityLogWarning("DanMuInfo length wrong! info == " + info);
     }
 }
Example #26
0
 static public InputEventCtrl GetInstance()
 {
     if (Instance == null)
     {
         GameObject obj = new GameObject("_InputEventCtrl");
         Instance = obj.AddComponent <InputEventCtrl>();
         pcvr.GetInstance();
         XKGlobalData.GetInstance();
         SetPanelCtrl.GetInstance();
     }
     return(Instance);
 }
Example #27
0
 /// <summary>
 /// 更新机台弹幕信息.
 /// </summary>
 internal void UpdateDanMuInfo()
 {
     if (m_DanMuLable != null)
     {
         string danMuInfo = XKGlobalData.GetInstance().m_DanMuInfo;
         if (danMuInfo != "")
         {
             //SSDebug.Log("UpdateDanMuInfo -> danMuInfo ===================== " + danMuInfo);
             m_DanMuLable.text = danMuInfo;
         }
     }
 }
Example #28
0
 internal void Init()
 {
     if (m_DanMuLable != null)
     {
         string danMuInfo = XKGlobalData.GetInstance().m_DanMuInfo;
         if (danMuInfo != "")
         {
             m_DanMuLable.text = danMuInfo;
         }
     }
     UpdateShangJiaDanMuInfo();
 }
Example #29
0
 public void SetPlayerCoin(int coin)
 {
     XKGlobalData.GetInstance();
     if (XKGlobalData.GameVersionPlayer != 0)
     {
         if (PlayerSt == PlayerEnum.PlayerOne || PlayerSt == PlayerEnum.PlayerTwo)
         {
             return;
         }
     }
     SetPlayerCoinSprite(coin);
 }
 public void ShowGameOver()
 {
     if (IsShowGameOver)
     {
         return;
     }
     IsShowGameOver = true;
     XKGlobalData.GetInstance().PlayAudioGameOver();
     GameOverObj.SetActive(true);
     Invoke("HiddenGameOver", 3f);
     MakeServerShowGameOver();
 }