public void ClickFireBtThree(pcvr.ButtonState val) { if (ClickFireBtThreeEvent != null) { ClickFireBtThreeEvent(val); if (XkGameCtrl.GetIsActivePlayer(PlayerEnum.PlayerThree) == false || SSUIRoot.GetInstance().GetIsActiveCaiPiaoBuZuPanel(PlayerEnum.PlayerThree) == true) { ClickStartBtThree(val); } } }
/// <summary> /// 设置二维码是否可见. /// </summary> internal void SetActive(bool isActive) { if (gameObject.activeInHierarchy != isActive) { //SSDebug.Log("SetActive -> isActive =========================== " + isActive); gameObject.SetActive(isActive); if (SSUIRoot.GetInstance().m_GameUIManage != null && SSUIRoot.GetInstance().m_GameUIManage.m_ScreenIdCom != null) { SSUIRoot.GetInstance().m_GameUIManage.m_ScreenIdCom.OnSetActiveHddErWeiMa(isActive); } } }
//static SSExitGameUI _Instance; //public static SSExitGameUI GetInstance() //{ // return _Instance; //} public void Init() { m_ExitType = ExitEnum.QuXiao; SSUIRoot.GetInstance().m_ExitUICom = this; QueDingUI.mainTexture = QueDingImg[0]; QuXiaoUI.mainTexture = QuXiaoImg[1]; SetAcitveBtFlash(); QueDingUI.transform.localScale = m_SmallScale; QuXiaoUI.transform.localScale = m_BigScale; //InputEventCtrl.GetInstance().ClickTVYaoKongEnterBtEvent += ClickTVYaoKongEnterBtEvent; //InputEventCtrl.GetInstance().ClickTVYaoKongExitBtEvent += ClickTVYaoKongExitBtEvent; //InputEventCtrl.GetInstance().ClickTVYaoKongLeftBtEvent += ClickTVYaoKongLeftBtEvent; //InputEventCtrl.GetInstance().ClickTVYaoKongRightBtEvent += ClickTVYaoKongRightBtEvent; }
IEnumerator DelayLoadingReconectServerGameScene() { IsLoadingReconnectServerScene = true; if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSUIRoot.GetInstance().m_GameUIManage.CreateCompanyLogo(); } //if (pcvr.GetInstance().m_HongDDGamePadInterface != null) //{ // //关闭WebSocket // pcvr.GetInstance().m_HongDDGamePadInterface.CloseWebSocket(); //} UITexture uiTexture = gameObject.GetComponent <UITexture>(); if (uiTexture != null) { uiTexture.enabled = false; } float audioVol = 1f; do { yield return(new WaitForSeconds(0.1f)); audioVol -= 0.05f; if (audioVol < 0f) { audioVol = 0f; } AudioListener.volume = audioVol; if (audioVol <= 0f) { break; } } while (true); yield return(new WaitForSeconds(0.2f)); if (pcvr.GetInstance().m_HongDDGamePadInterface != null) { //重启websocket. pcvr.GetInstance().m_HongDDGamePadInterface.OnXiTiaoMsgTimeOutFromWangLuoGuZhang(); } XkGameCtrl.IsLoadingLevel = false; XkGameCtrl.GetInstance().LoadingReconnectServerGameScene(); }
/// <summary> /// 更新游戏商户弹幕数据信息. /// </summary> internal void UpdateShangHuDanMuInfo(string[] shangHuDanMuInfoArray) { for (int i = 0; i < m_ShangHuDanMuDt.Length; i++) { m_ShangHuDanMuDt[i].ShangHuDanMuInfo = shangHuDanMuInfoArray[i]; //SSDebug.Log("UpdateShangHuDanMuInfo -> ShangHuDanMuInfo[" + i + "] ===== " + shangHuDanMuInfoArray[i]); } if (SSUIRoot.GetInstance().m_GameUIManage != null && SSUIRoot.GetInstance().m_GameUIManage.m_DanMuTextUI != null) { //更新游戏弹幕的商户名信息. SSUIRoot.GetInstance().m_GameUIManage.m_DanMuTextUI.UpdateShangJiaDanMuInfo(); } }
void StartPlayGame() { gameObject.SetActive(false); ScreenDanHeiCtrl.GetInstance().ActiveGameUiCamera(); XkPlayerCtrl.GetInstanceFeiJi().RestartMovePlayer(); if (GameTimeCtrl.GetInstance() != null) { GameTimeCtrl.GetInstance().ActiveIsCheckTimeSprite(); } if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSUIRoot.GetInstance().m_GameUIManage.RemoveGameStartTimeUI(); } }
void HiddenBossLaiXi() { //XKGlobalData.GetInstance().StopAudioBossLaiXi(); TweenAlpha twAlpha = GetComponent <TweenAlpha>(); if (twAlpha != null) { DestroyObject(twAlpha); } gameObject.SetActive(false); if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSUIRoot.GetInstance().m_GameUIManage.RemoveBossLaiXiUI(); } }
/// <summary> /// 彩票机无票. /// </summary> private void OnCaiPiaJiWuPiaoEvent(pcvrTXManage.CaiPiaoJi val) { int indexVal = (int)val; if (indexVal < 0 || indexVal > 2) { Debug.LogWarning("OnCaiPiaJiWuPiaoEvent -> indexVal was wrong! indexVal ==== " + indexVal); return; } PlayerEnum indexPlayer = (PlayerEnum)(indexVal + 1); if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSUIRoot.GetInstance().m_GameUIManage.CreatCaiPiaoBuZuPanel(indexPlayer); } }
void ShowPiaoFen(PlayerEnum indexPlayer) { if (JiFenVal <= 0) { return; } if (m_PiaoFenPoint == null) { return; } if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSUIRoot.GetInstance().m_GameUIManage.ShowNpcPiaoFenUI(indexPlayer, GetJiFen(), m_PiaoFenPoint.position); } }
/// <summary> /// 当玩家获得分数足够抽奖时. /// </summary> internal void OnPlayerFenShuZuGouChouJiang() { if (IsOnPlayerFenShuZuGou == true) { return; } IsOnPlayerFenShuZuGou = true; //隐藏距抽奖还差多少分. SetActiveHaiChaFenShuObj(false); //显示"恭喜玩家获得抽奖机会" SetActiveGongXiHuoDe(true); if (SSUIRoot.GetInstance().m_GameUIManage != null) { //创建玩家分数足够游戏抽奖的界面. SSUIRoot.GetInstance().m_GameUIManage.CreatePlayerChouJiangFenShuZuGouPanel(m_PlayerIndex); } }
/// <summary> /// 展示玩家彩票信息. /// </summary> void ShowPlayerCaiPiaoInfo() { if (SSUIRoot.GetInstance().m_GameUIManage != null) { int indexVal = (int)IndexPlayer - 1; if (SSUIRoot.GetInstance().m_GameUIManage) { //显示玩家当前彩票数据信息. int caiPiao = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PcvrPrintCaiPiaoData[indexVal].CaiPiaoVal; int caiPiaoCache = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PcvrPrintCaiPiaoData[indexVal].CaiPiaoValCache; //m_GameNumUI.ShowNumUI(caiPiao + caiPiaoCache); if (SSUIRoot.GetInstance().m_GameUIManage != null) { //显示玩家彩票数量. SSUIRoot.GetInstance().m_GameUIManage.ShowPlayerCaiPiaoInfo(IndexPlayer, caiPiao + caiPiaoCache); } } } }
public void ClickFireBtTwo(pcvr.ButtonState val) { if (XKGlobalData.GameVersionPlayer == 0) { if (ClickFireBtTwoEvent != null) { ClickFireBtTwoEvent(val); } if (XkGameCtrl.GetIsActivePlayer(PlayerEnum.PlayerTwo) == false || SSUIRoot.GetInstance().GetIsActiveCaiPiaoBuZuPanel(PlayerEnum.PlayerTwo) == true) { ClickStartBtTwo(val); } } else { ClickFireBtFour(val); } }
/// <summary> /// 重置正常得彩信息. /// </summary> public void ResetZhengChangDeCai(PlayerEnum index) { int indexVal = (int)index - 1; if (indexVal < 0 || indexVal >= XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PlayerCoinData.Length) { return; } float timeVal = Time.time - XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PlayerCoinData[indexVal].TimeActive; int deCaiVal = ZhengChangDeCai; ZhengChangDeCaiData[] data = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_ZhengChangDeCaiData; float deCaiBiLi = 0; for (int i = 0; i < data.Length; i++) { if (timeVal <= data[i].TimeVal) { deCaiBiLi = data[i].DeCaiBiLi; break; } } deCaiVal = (int)(ZhengChangDeCai * deCaiBiLi); //回收彩票. int huiShouCaiPiao = ZhengChangDeCai - deCaiVal; XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameYuZhiCaiPiaoData.AddYuZhiCaiPiao(huiShouCaiPiao); ZhengChangDeCai = deCaiVal; if (deCaiVal > 0) { //这个时候应该打印出玩家的正常产得彩数量. Debug.Log("Unity: ResetZhengChangDeCai -> index ========== " + index + ", ZhengChangDeCai ==== " + ZhengChangDeCai + ", deCaiBiLi == " + deCaiBiLi); //显示玩家剩余彩票成就UI. SSUIRoot.GetInstance().m_GameUIManage.CreatePlayerCaiPiaoChengJiu(index, deCaiVal); //XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.AddCaiPiaoToPlayer(index, deCaiVal, GameCaiPiaoData.DeCaiState.ZhengChang); } ZhengChangDeCai = 0; }
void FixedUpdate() { if (IsRemoveSelf) { return; } if (IsBtDownSetMove) { m_TimeValBtDown += Time.fixedDeltaTime; if (m_TimeValBtDown >= 2f) { //工作人员长按移动按键时. //清空当前缺票机位的彩票信息. if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSUIRoot.GetInstance().m_GameUIManage.RemoveAllCaiPiaoBuZuPanel(); } } } }
/// <summary> /// 恢复代金券npc的血值数据及UI信息. /// </summary> internal void BackDaiJinQuanNpcBlood() { if (NpcScript.IsZhanCheNpc || NpcScript.IsJPBossNpc) { if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == false) { //当有玩家激活游戏时,恢复彩票战车和JPBoss的血值信息. if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null) { if (NpcScript.GetIsBossNpc() == true) { //跟新JPBoss的血值数据. //MaxPuTongAmmo = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_CurentTotalHealthDt.JPBossHealth.MaxPuTongAmmo; //SSDebug.Log("*********************************************************44444444444444444444444444444444"); SetJPBossHealthInfo(NpcScript); } else { //跟新战车Npc的血值数据. MaxPuTongAmmo = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_CurrentTotalHealthDt.ZhanCheHealth.MaxPuTongAmmo; } } //重置代金券npc的伤害数值. PuTongAmmoCount = 0; IsBackDaiJinQuanNpcBlood = true; m_TimeLastBackDaiJinQuanNpcBlood = Time.time; //重置代金券npc的血条UI信息. float perVal = 0.5f; if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null) { perVal = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_CurrentTotalHealthDt.UIHealthPer; //重置Boss为不可以被击爆,避免玩家击爆AI坦克刷出的可以被击爆的Boss. XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_CurrentTotalHealthDt.IsCanJiBao = false; } SSUIRoot.GetInstance().m_GameUIManage.BackBloodBossAmount(perVal); } } }
void Update() { if (m_GameNumUI != null && IsInitCaiPiaoAni) { if (Time.time - TimeLastCaiPiaoAni <= TimeCaiPiaoAni) { m_GameNumUI.ShowNumUI(UnityEngine.Random.Range(m_MinCaiPiaoNumAni, m_MaxCaiPiaoNumAni)); } else { UnityLog("SSCaiPiaoInfo::CloseCaiPiaoAnimation -> indexPlayer == " + IndexPlayer + ", time == " + Time.time); //结束彩票数字动画. IsInitCaiPiaoAni = false; if (SSUIRoot.GetInstance().m_GameUIManage != null) { int indexVal = (int)IndexPlayer - 1; if (SSUIRoot.GetInstance().m_GameUIManage) { //显示玩家当前彩票数据信息. int caiPiao = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PcvrPrintCaiPiaoData[indexVal].CaiPiaoVal; int caiPiaoCache = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PcvrPrintCaiPiaoData[indexVal].CaiPiaoValCache; //m_GameNumUI.ShowNumUI(caiPiao + caiPiaoCache); if (SSUIRoot.GetInstance().m_GameUIManage != null) { //显示玩家彩票数量. SSUIRoot.GetInstance().m_GameUIManage.ShowPlayerCaiPiaoInfo(IndexPlayer, caiPiao + caiPiaoCache, false, true); } } } if (m_AniAudio != null) { m_AniAudio.Stop(); m_AniAudio.enabled = false; } } } }
/// <summary> /// 减少玩家彩票. /// </summary> internal void SubPlayerCaiPiao(PlayerEnum indexPlayer, int caiPiao) { int index = (int)indexPlayer - 1; if (index < 0 || index > 2) { UnityLogWarning("SubPlayerCaiPiao -> index was wrong! index ==== " + index); return; } if (m_PcvrPrintCaiPiaoData[index].CaiPiaoVal >= caiPiao) { m_PcvrPrintCaiPiaoData[index].CaiPiaoVal -= caiPiao; } else { m_PcvrPrintCaiPiaoData[index].CaiPiaoVal = 0; } if (m_PcvrPrintCaiPiaoData[index].CaiPiaoVal <= 0) { //彩票已经打印完成. m_PcvrPrintCaiPiaoData[index].IsPrintCaiPiao = false; if (m_PcvrPrintCaiPiaoData[index].CaiPiaoValCache > 0) { //开始打印缓冲区彩票. StartPrintCaiPiaoCache(indexPlayer); } } //Debug.Log("SubPlayerCaiPiao ->CaiPiaoVal ===== " + m_PcvrPrintCaiPiaoData[index].CaiPiaoVal // + ", CaiPiaoValCache ==== " + m_PcvrPrintCaiPiaoData[index].CaiPiaoValCache // + ", subCaiPiao ====== " + caiPiao); if (SSUIRoot.GetInstance().m_GameUIManage != null) { //删除彩票不足UI界面. SSUIRoot.GetInstance().m_GameUIManage.RemoveCaiPiaoBuZuPanel(indexPlayer, false); } }
void OnSreenAlphaToMin() { if (Network.peerType != NetworkPeerType.Server) { //ZhunXingTeXiaoCtrl.GetInstance().ShowZhunXingTeXiao(); if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSUIRoot.GetInstance().m_GameUIManage.CreatGameStartTimeUI(); } if (GameStartTimeCtrl.GetInstance() != null) { GameStartTimeCtrl.GetInstance().InitPlayStartTimeUI(); } } else { StartCameraObj.SetActive(false); ScreenDanHeiObj.SetActive(false); } if (/*XkGameCtrl.GetInstance().IsServerCameraTest ||*/ Network.peerType == NetworkPeerType.Server) { XkGameCtrl.ActiveServerCameraTran(); if (XKPlayerCamera.GetInstanceFeiJi() != null) { XKPlayerCamera.GetInstanceFeiJi().SetEnableCamera(false); } if (XKPlayerCamera.GetInstanceTanKe() != null) { XKPlayerCamera.GetInstanceTanKe().SetEnableCamera(false); } } IsSreenAlphaToMin = true; IsOpenSreenAlphaToMin = false; }
/// <summary> /// 播放玩家当前打印彩票的数字缩放动画. /// </summary> void PlayCaiPiaoNumAnimationSuoFang() { if (IsPlayCaiPiaoNumAniSuoFang == true) { return; } IsPlayCaiPiaoNumAniSuoFang = true; //播放玩家当前打印彩票的数字缩放动画. if (SSUIRoot.GetInstance().m_GameUIManage != null) { int indexVal = (int)IndexPlayer - 1; if (indexVal >= 0 && indexVal <= 2) { //添加剩余彩票数. XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.AddCaiPiaoToPlayer(IndexPlayer, m_CardNumVal, SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhengChang, false); int caiPiao = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PcvrPrintCaiPiaoData[indexVal].CaiPiaoVal; int caiPiaoCache = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PcvrPrintCaiPiaoData[indexVal].CaiPiaoValCache; //显示玩家彩票数量. SSUIRoot.GetInstance().m_GameUIManage.ShowPlayerCaiPiaoInfo(IndexPlayer, caiPiao + caiPiaoCache, true, true); } } }
public void HiddenBossXueTiao() { //删除代金券npc的血条UI. SSUIRoot.GetInstance().m_GameUIManage.RemoveDaiJinQuanNpcXueTiaoUI(); }
public void StartPlayDaoJiShi() { if (XKGlobalData.GetInstance().m_SSGameXuMingData != null) { if (XKGlobalData.GetInstance().m_SSGameXuMingData.GetIsCanXuMing(PlayerIndex) == false) { //续命次数超出. //此时需要发送不允许继续游戏的消息给手柄,30秒之后游戏发送踢出该玩家的消息给手柄(同时需要清除玩家的微信数据) if (pcvr.GetInstance().m_HongDDGamePadInterface != null) { //清理玩家微信数据. pcvr.GetInstance().m_HongDDGamePadInterface.SendWXPadShowFangChenMiPanel(PlayerIndex); } } } if (GameOverCtrl.IsShowGameOver) { return; } if (XkGameCtrl.GetInstance().GetPlayerIsCanContinuePlayGame(PlayerIndex) == true) { //玩家币值充足,可以继续进行游戏. return; } else { //玩家币值不足,需要进行充值. //if (pcvr.GetInstance().m_HongDDGamePadInterface.GetHongDDGamePadWXPay() != null) //{ // //玩家币值不足,通知游戏服务端拉起手机微信复活重置界面. // pcvr.GetInstance().m_HongDDGamePadInterface.GetHongDDGamePadWXPay().CToS_OnPlayerDeath("0"); //} } if (IsPlayDaoJishi) { return; } IsPlayDaoJishi = true; //SSDebug.Log("StartPlayDaoJiShi******************************************************IsPlayDaoJishi " + IsPlayDaoJishi + ", Time ======= " + Time.time.ToString("f2")); #if NOT_SHOW_DAOJISHI_UI if (pcvr.IsHongDDShouBing == true) { //微信支付版本不显示倒计时数字信息. ContinueGameObj.SetActive(true); return; } #endif if (XKGlobalData.GetInstance().m_MianFeiShiWanCount <= 0) { //首次付费模式. if (m_MianFeiTimeUI != null) { m_MianFeiTimeUI.SetActive(false); } } else { //首次免费模式. if (m_MianFeiTimeUI != null) { m_MianFeiTimeUI.SetActive(true); if (m_TimeMianFeiNum != null) { //显示下次免费游戏的间隔时间数字. //m_TimeMianFeiNum.ShowNumUI(XKGlobalData.GetInstance().m_TimeMianFeiNum); m_TimeMianFeiNum.text = XKGlobalData.GetInstance().m_TimeMianFeiNum.ToString(); } } } if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSUIRoot.GetInstance().m_GameUIManage.RemovePlayerDaiJinQunUI(PlayerIndex); } CountDaoJiShi++; DaoJiShiCount = 9; DaoJiShiSprite.enabled = false; DaoJiShiSprite.spriteName = "daoJiShi9"; DaoJiShiObj.SetActive(true); StartCoroutine(DelayShowPlayerDaoJiShi()); //m_TVYaoKongEnterObj.SetActive(true); //DaoJiShiObj.SetActive(true); //ContinueGameObj.SetActive(true); //ShowDaoJiShiInfo(); //XKGlobalData.GetInstance().StopAudioRanLiaoJingGao(); //pcvr.CloseAllQiNangArray(PlayerIndex, 1); }
public void OnDamageNpc(int damageNpcVal = 1, PlayerEnum playerSt = PlayerEnum.Null, PlayerAmmoType pAmmoType = PlayerAmmoType.Null, bool isAiFireAmmo = false) { if (IsDeathNpc) { return; } if (pAmmoType == PlayerAmmoType.SanDanAmmo) { if (Time.time - TimeSanDanDamage < XKPlayerGlobalDt.GetInstance().TimeShouDongDaoDan) { //对于玩家的主炮散弹在同一次发射内只计算一次伤害. //SSDebug.LogWarning("************* pAmmoType ====== " + pAmmoType); return; } TimeSanDanDamage = Time.time; } if (pAmmoType == PlayerAmmoType.ChuanTouAmmo) { if (XKPlayerMvFanWei.GetInstanceQian() != null && XKPlayerCamera.GetInstanceFeiJi() != null) { Vector3 forwardVecCam = XKPlayerCamera.GetInstanceFeiJi().transform.forward; Vector3 posA = transform.position; Vector3 posB = XKPlayerMvFanWei.GetInstanceQian().transform.position; forwardVecCam.y = posA.y = posB.y = 0f; Vector3 vecBA = posA - posB; if (Vector3.Dot(forwardVecCam, vecBA) >= 0f) { //npc在镜头前方范围之外,不受玩家子弹伤害. return; } } } if (IsBackDaiJinQuanNpcBlood == true) { //代金券npc重置血值后,给一定时间的无敌状态. if (Time.time - m_TimeLastBackDaiJinQuanNpcBlood <= 0.5f) { return; } else { IsBackDaiJinQuanNpcBlood = false; } } //switch (NpcJiFen) //{ // case NpcJiFenEnum.Boss: // if (!XKBossXueTiaoCtrl.GetInstance().GetIsCanSubXueTiaoAmount()) // { // if (NpcDamageCom != null) // { // NpcDamageCom.PlayNpcDamageEvent(); // } // return; // } // break; //} if (NpcDamageCom != null) { NpcDamageCom.PlayNpcDamageEvent(); } if (NpcScript != null) { if (NpcScript.IsCaiPiaoZhanChe == true && NpcScript.IsEnterCameraBox == false) { //彩票战车和boss没有进入摄像机盒子,不计算伤害. return; } } if (CountActivePlayer != XkGameCtrl.PlayerActiveNum) { if (CountActivePlayer != 0) { //fix PuTongAmmoCount. int indexValTmp = CountActivePlayer - 1; int puTongAmmoNumTmp = MaxPuTongAmmo[indexValTmp]; indexValTmp = XkGameCtrl.PlayerActiveNum - 1; if (indexValTmp >= 0) { float healthPer = (float)PuTongAmmoCount / puTongAmmoNumTmp; //int oldPuTongAmmoCount = PuTongAmmoCount; PuTongAmmoCount = (int)(healthPer * MaxPuTongAmmo[indexValTmp]); /*Debug.Log("Unity:"+"fix npc health -> PuTongAmmoCount "+PuTongAmmoCount +", oldPuTongAmmoCount "+oldPuTongAmmoCount);*/ } } CountActivePlayer = XkGameCtrl.PlayerActiveNum; } if (NpcScript == null || (NpcScript != null && !NpcScript.GetIsWuDi())) { PuTongAmmoCount += damageNpcVal; } int indexVal = XkGameCtrl.PlayerActiveNum - 1; indexVal = indexVal < 0 ? 0 : indexVal; int puTongAmmoNum = MaxPuTongAmmo[indexVal]; if (NpcScript != null) { if (NpcScript.IsZhanCheNpc || NpcScript.IsJPBossNpc) { if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true) { //当没有玩家激活游戏时,彩票战车和JPBoss采用原血量的一定比例来计算. puTongAmmoNum = (int)(XkGameCtrl.GetInstance().m_ZhanCheBossBloodPer *puTongAmmoNum); } } } /*if (NpcJiFen == NpcJiFenEnum.Boss) * { * float bossAmount = (float)(puTongAmmoNum - PuTongAmmoCount) / puTongAmmoNum; * bossAmount = bossAmount < 0f ? 0f : bossAmount; * if (XKBossXueTiaoCtrl.GetInstance() != null) * { * XKBossXueTiaoCtrl.GetInstance().SetBloodBossAmount(bossAmount, this); * } * }*/ if (NpcScript != null) { if (NpcScript.IsCaiPiaoZhanChe == true) { if (XkGameCtrl.GetInstance() != null && XKPlayerFenShuCtrl.GetInstance() != null) { if (pAmmoType == PlayerAmmoType.DaoDanAmmo || pAmmoType == PlayerAmmoType.PaiJiPaoAmmo || pAmmoType == PlayerAmmoType.ChuanTouAmmo || pAmmoType == PlayerAmmoType.SanDanAmmo || pAmmoType == PlayerAmmoType.ChongJiBoAmmo) { int jiFenVal = XkGameCtrl.GetInstance().m_DaoDanHitBossJiFen; //XKPlayerFenShuCtrl.GetInstance().ShowPlayerFenShu(playerSt, GetJiFen(jiFenVal)); XKPlayerFenShuCtrl.GetInstance().ShowPlayerFenShu(playerSt, jiFenVal); } } float bloodAmount = (float)(puTongAmmoNum - PuTongAmmoCount) / puTongAmmoNum; bloodAmount = bloodAmount < 0f ? 0f : bloodAmount; bool isCanJiBao = true; if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true) { //没有玩家激活游戏时,Ai都认为是可以击爆战车或Boss. } else { //有玩家激活游戏. if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null) { isCanJiBao = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_CurrentTotalHealthDt.IsCanJiBao; } } if (isCanJiBao == false) { //不允许被玩家击爆的代金券npc. if (IsBloodToStage02 == false) { if (bloodAmount <= 0.24f) { //强制保留一定的血量. m_BloodAmoutValue = bloodAmount = 0.24f; IsBloodToStage02 = true; m_TimeLastBloodToStage = Time.time; PuTongAmmoCount = puTongAmmoNum - 1; } } else if (IsBloodToStage01 == false) { float minBloodAmount = 0.12f; //最小极限血值. if (m_BloodAmoutValue > minBloodAmount) { //血值已经降到最低阶段. float dTimeVal = 0.4f; if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null) { dTimeVal = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_TimeNoDead; } if (Time.time - m_TimeLastBloodToStage >= dTimeVal) { //每次间隔一定时间减少一定血值. m_TimeLastBloodToStage = Time.time; float subBloodAmount = 0.02f; //每次减少的血值. if (m_BloodAmoutValue > minBloodAmount) { m_BloodAmoutValue -= subBloodAmount; if (m_BloodAmoutValue < minBloodAmount) { //强制保护的血值信息. m_BloodAmoutValue = minBloodAmount; IsBloodToStage01 = true; } } } } bloodAmount = m_BloodAmoutValue; PuTongAmmoCount = puTongAmmoNum - 1; //强制保留一定的血值. } else { float minBloodAmount = 0.03f; //最小极限血值. if (m_BloodAmoutValue > minBloodAmount) { //血值已经降到最低阶段. float dTimeVal = 0.4f; if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null) { dTimeVal = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_TimeNoDead; } if (Time.time - m_TimeLastBloodToStage >= dTimeVal) { //每次间隔一定时间减少一定血值. m_TimeLastBloodToStage = Time.time; float subBloodAmount = 0.01f; //每次减少的血值. if (m_BloodAmoutValue > minBloodAmount) { m_BloodAmoutValue -= subBloodAmount; if (m_BloodAmoutValue < minBloodAmount) { //强制保护的血值信息. m_BloodAmoutValue = minBloodAmount; } } } } bloodAmount = m_BloodAmoutValue; PuTongAmmoCount = puTongAmmoNum - 1; //强制保留一定的血值. } } //彩票战车和boss的血条UI信息更新. SSUIRoot.GetInstance().m_GameUIManage.SetDaiJinQuanNpcXueTiaoAmount(bloodAmount); if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true) { //没有玩家激活游戏时,Ai都认为是不可以击爆JPBoss特殊武器的. } else { //JPBoss受到玩家子弹伤害. if (NpcScript.IsJPBossNpc == true) { NpcScript.OnDamageJPBossWeapon(bloodAmount); } } } } /*Debug.Log("Unity:"+"OnDamageNpc -> " +", nameNpc "+NpcNameInfo +", puTongAmmoNum "+puTongAmmoNum);*/ if (PuTongAmmoCount >= puTongAmmoNum) { if (NpcScript != null) { if (NpcScript.IsZhanCheNpc) { //战车npc是否可以被击爆的判断. if (XkGameCtrl.GetInstance().IsCaiPiaoHuLuePlayerIndex == false && NpcScript.m_IndexPlayerJiBao != playerSt) { //不是可以击爆战车npc的玩家. return; } if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true) { //没有激活任何玩家. } else { if (!XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetIsChuCaiPiaoByDeCaiState(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe, NpcScript.m_DaiJinQuanState)) { //战车彩池的彩票积累的不够. return; } } } if (NpcScript.IsJPBossNpc) { //JPBoss是否可以被击爆的判断. if (XkGameCtrl.GetInstance().IsCaiPiaoHuLuePlayerIndex == false && NpcScript.m_IndexPlayerJiBao != playerSt) { //不是可以击爆JPBoss的玩家. return; } if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true) { //没有激活任何玩家. } else { if (!XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetIsChuCaiPiaoByDeCaiState(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss)) { //JPBoss彩池的彩票积累的不够. return; } } } } if (IsDeathNpc) { return; } IsDeathNpc = true; if (IsOpenCameraShake) { XKPlayerCamera.GetInstanceFeiJi().HandlePlayerCameraShake(); } if (NpcJiFen == NpcJiFenEnum.Boss && BossXieZiScript != null) { BossXieZiScript.ResetBossXieZiShouBiInfo(); } if (BoxColCom != null) { BoxColCom.enabled = false; } CheckSpawnDaoJuCom(playerSt); CheckNpcDeathExplode(playerSt); CheckHiddenNpcObjArray(); // bool isAddKillNpcNum = true; // if (NpcScript != null && CannonScript != null) { // if (NpcScript.GetIsDeathNPC()) { // isAddKillNpcNum = false; // Debug.Log("Unity:"+"name "+NpcScript.name+", isAddKillNpcNum "+isAddKillNpcNum); // } // } if (!IsYouTongNpc) { switch (NpcJiFen) { case NpcJiFenEnum.Boss: if (GameTimeBossCtrl.GetInstance() != null && GameTimeBossCtrl.GetInstance().GetTimeBossResidual() > 0) { XkGameCtrl.GetInstance().AddPlayerKillNpc(PlayerEnum.Null, NpcJiFen, GetJiFen()); } break; default: XkGameCtrl.GetInstance().AddPlayerKillNpc(playerSt, NpcJiFen, GetJiFen()); ShowPiaoFen(playerSt); break; } // if (isAddKillNpcNum) { // switch (NpcJiFen) { // case NpcJiFenEnum.Boss: // if (GameTimeBossCtrl.GetInstance().GetTimeBossResidual() > 0) { // XkGameCtrl.GetInstance().AddPlayerKillNpc(PlayerEnum.Null, NpcJiFen, JiFenVal); // } // break; // default: // XkGameCtrl.GetInstance().AddPlayerKillNpc(playerSt, NpcJiFen, JiFenVal); // break; // } // } } else { CheckYouTongDamageNpc(); } if (NpcScript != null) { if (CannonScript != null) { CannonScript.OnRemoveCannon(playerSt, 1); } if (NpcJiFen != NpcJiFenEnum.Boss && NpcScript.GetIsBossNpc()) { return; } NpcScript.TriggerRemovePointNpc(1, CannonScript, pAmmoType); if (NpcScript.IsCaiPiaoZhanChe) { SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState deCaiType = SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe; //彩票boss或战车npc. if (NpcScript.GetIsBossNpc()) { deCaiType = SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss; } else { if (XkPlayerCtrl.GetInstanceFeiJi() != null) { XkPlayerCtrl.GetInstanceFeiJi().AddGetZhanCheDaiJinQuanPlayer(XKPlayerMoveCtrl.GetInstance(playerSt)); } } if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage != null) { if (isAiFireAmmo == false) { //只有被玩家击爆的代金券npc才允许出彩. XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.SubGameDeCaiValByDeCaiState(playerSt, deCaiType, SSCaiPiaoDataManage.SuiJiDaoJuState.BaoXiang, NpcScript.m_DaiJinQuanState); } //else //{ //被Ai坦克击爆的代金券npc不允许出彩. //SSDebug.Log("The DaiJinQuan was killed by AiTank"); //} } } else { //普通npc被击杀. //if (XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData != null && DeathExplodePoint != null) //{ // //随机送出正常得彩. // XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData.CheckPlayerSongPiaoInfo(playerSt, DeathExplodePoint.position); //} } } else if (CannonScript != null) { CannonScript.OnRemoveCannon(playerSt, 1); //炮台类npc被击杀. //if (XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData != null && DeathExplodePoint != null) //{ // //随机送出正常得彩. // XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData.CheckPlayerSongPiaoInfo(playerSt, DeathExplodePoint.position); //} } } }
public void SetNpcMoveScript(XKNpcMoveCtrl script) { IsSpawnObj = true; NpcScript = script; if (NpcScript != null && NpcJiFen == NpcJiFenEnum.Boss) { NpcScript.SetIsBossNpc(true); } NpcNameInfo = script.name; ResetNpcHealthInfo(); if (m_CaiPiaoNpcUI != null) { if (NpcScript != null) { if (NpcScript.IsCaiPiaoZhanChe == true) { if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null && IsGetTotalHealthData == false) { IsGetTotalHealthData = true; //获取获取JPBoss和战车Npc的血值数据. if (NpcScript.IsJPBossNpc == true) { //JPBoss战车. XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.GetTotalHealthData(SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState.JPBossDaiJinQuan); } else { //战车01或02. XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.GetTotalHealthData(NpcScript.m_DaiJinQuanState); } //保存代金券npc的血条脚本. XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.SaveDaiJinQuanHealth(this); } SetRecordMaxPuTongAmmo(); if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true) { //没有玩家激活游戏,使用游戏记录的血值数据. MaxPuTongAmmo = MaxPuTongAmmoCache; } else { //有玩家正在进行游戏,使用游戏配置的血值数据. if (NpcScript.GetIsBossNpc() == true) { if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null) { //跟新JPBoss的血值数据. MaxPuTongAmmo = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_CurrentTotalHealthDt.JPBossHealth.MaxPuTongAmmo; //SSDebug.Log("*********************************************************3333333333333333333333333333333"); } } else { if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null) { //跟新战车Npc的血值数据. MaxPuTongAmmo = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_CurrentTotalHealthDt.ZhanCheHealth.MaxPuTongAmmo; } } } if (NpcScript.GetIsBossNpc() == true) { m_CaiPiaoNpcUI.ShowNumUI(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss, this); } else { m_CaiPiaoNpcUI.ShowNumUI(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe, this); } //创建代金券npc的血条信息. float perVal = 0.5f; if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null) { perVal = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_CurrentTotalHealthDt.UIHealthPer; } SSUIRoot.GetInstance().m_GameUIManage.CreatDaiJinQuanNpcXueTiaoUI(perVal); } NpcScript.m_CaiPiaoNpcUI = m_CaiPiaoNpcUI; } } TimeLastVal = Time.time; }
void CheckNpcDeathExplode(PlayerEnum indexPlayer = PlayerEnum.Null) { if (DeathExplode == null) { return; } if (NpcScript != null && NpcScript.IsCaiPiaoZhanChe) { SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState deCaiType = SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe; //彩票boss或战车npc. if (NpcScript.GetIsBossNpc()) { deCaiType = SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss; AudioBeiJingCtrl.StopGameBeiJingAudio(); } if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage != null) { int value = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetPrintCaiPiaoValueByDeCaiState(deCaiType, SSCaiPiaoDataManage.SuiJiDaoJuState.BaoXiang, NpcScript.m_DaiJinQuanState); if (DeathExplodePoint != null) { //Vector3 pos = XkGameCtrl.GetInstance().GetWorldObjToScreenPos(objExplode.transform.position); SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState daiJinQuanType = NpcScript.m_DaiJinQuanState; SSUIRoot.GetInstance().m_GameUIManage.CreatZhanCheBossCaiPiaoZhuanPan(indexPlayer, value, DeathExplodePoint.position, deCaiType, DeathExplode, daiJinQuanType); //SSCaiPiaoLiZiManage caiPiaoLiZi = objExplode.GetComponent<SSCaiPiaoLiZiManage>(); //if (caiPiaoLiZi != null) //{ // caiPiaoLiZi.ShowNumUI(value, indexPlayer); //} //else //{ // Debug.LogWarning("CheckNpcDeathExplode -> caiPiaoLiZi was null................."); //} if (deCaiType == SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss) { //只给boss产生爆炸粒子. GameObject objExplode = (GameObject)Instantiate(DeathExplode, DeathExplodePoint.position, DeathExplodePoint.rotation); objExplode.transform.parent = XkGameCtrl.NpcAmmoArray; XkGameCtrl.CheckObjDestroyThisTimed(objExplode); SSCaiPiaoLiZiManage caiPiaoLiZi = objExplode.GetComponent <SSCaiPiaoLiZiManage>(); if (caiPiaoLiZi != null) { caiPiaoLiZi.ShowNumUI(value, indexPlayer); } else { Debug.LogWarning("CheckNpcDeathExplode -> caiPiaoLiZi was null................."); } } } } //if (deCaiType == SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe) //{ // if (XkGameCtrl.GetInstance().m_CaiPiaoFlyData != null) // { // //初始化飞出的彩票逻辑. // XkGameCtrl.GetInstance().m_CaiPiaoFlyData.InitCaiPiaoFly(transform.position, indexPlayer, SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe); // } // else // { // Debug.LogWarning("CreatLiZi -> m_CaiPiaoFlyData was null............"); // } //} //else if (deCaiType == SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss) //{ // if (SSUIRoot.GetInstance().m_GameUIManage != null) // { // SSUIRoot.GetInstance().m_GameUIManage.InitCaiPiaoAnimation(XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_JPBossCaiPiaoFlyDt.TimeLeiJiaVal, indexPlayer); // } // if (XkGameCtrl.GetInstance().m_CaiPiaoFlyData != null) // { // //初始化烟花粒子的产生. // XkGameCtrl.GetInstance().m_CaiPiaoFlyData.InitPlayCaiPiaoYanHua(); // } // else // { // Debug.LogWarning("CreatLiZi -> m_CaiPiaoFlyData was null............"); // } //} } else { GameObject objExplode = (GameObject)Instantiate(DeathExplode, DeathExplodePoint.position, DeathExplodePoint.rotation); objExplode.transform.parent = XkGameCtrl.NpcAmmoArray; XkGameCtrl.CheckObjDestroyThisTimed(objExplode); } }
/// <summary> /// 添加彩票给玩家. /// </summary> internal void AddCaiPiaoToPlayer(PlayerEnum indexPlayer, int caiPiao, GameCaiPiaoData.DeCaiState type, bool isPlayCaiPiaoNumAni = true) { int index = (int)indexPlayer - 1; if (index < 0 || index > 2) { UnityLogWarning("AddCaiPiaoToPlayer -> index was wrong! index ==== " + index); return; } //test //if (type != GameCaiPiaoData.DeCaiState.ZhanChe) //{ // return; //} //test if (type == GameCaiPiaoData.DeCaiState.JPBoss) { if (m_PcvrPrintCaiPiaoData[index].IsDaJiangCaiPiao == false) { m_PcvrPrintCaiPiaoData[index].IsDaJiangCaiPiao = true; //产生彩票大奖UI界面. if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSUIRoot.GetInstance().m_GameUIManage.CreatCaiPiaoDaJiangPanel(indexPlayer, caiPiao); } } } XKGlobalData.GetInstance().SetTotalOutPrintCards(XKGlobalData.GetInstance().m_TotalOutPrintCards + caiPiao); if (m_PcvrPrintCaiPiaoData[index].IsPrintCaiPiao) { //当前机位正在打印彩票. //将新得到的彩票存入缓冲区. m_PcvrPrintCaiPiaoData[index].CaiPiaoValCache += caiPiao; if (isPlayCaiPiaoNumAni == true) { //有播放彩票数字动画,等动画播完在更新彩票数字UI. } else { //没有播放彩票数字动画,直接更新彩票数字UI. if (SSUIRoot.GetInstance().m_GameUIManage != null) { //显示玩家彩票数量. SSUIRoot.GetInstance().m_GameUIManage.ShowPlayerCaiPiaoInfo(indexPlayer, m_PcvrPrintCaiPiaoData[index].CaiPiaoVal + m_PcvrPrintCaiPiaoData[index].CaiPiaoValCache, false, true); } } return; } m_PcvrPrintCaiPiaoData[index].IsPrintCaiPiao = true; m_PcvrPrintCaiPiaoData[index].CaiPiaoVal += caiPiao; //if (isPlayCaiPiaoNumAni == true) //{ // //有播放彩票数字动画,等动画播完在更新彩票数字UI. //} //else //{ // //没有播放彩票数字动画,直接更新彩票数字UI. // if (SSUIRoot.GetInstance().m_GameUIManage != null) // { // //显示玩家彩票数量. // SSUIRoot.GetInstance().m_GameUIManage.ShowPlayerCaiPiaoInfo(indexPlayer, // m_PcvrPrintCaiPiaoData[index].CaiPiaoVal + m_PcvrPrintCaiPiaoData[index].CaiPiaoValCache); // } //} Debug.Log("AddCaiPiaoToPlayer ->CaiPiaoVal ===== " + m_PcvrPrintCaiPiaoData[index].CaiPiaoVal + ", addCaiPiao ====== " + caiPiao + ", coinToCaiPiao ==== " + XKGlobalData.GetInstance().m_CoinToCard); //这里添加pcvr打印彩票的消息. StartCoroutine(DelayPrintPlayerCaiPiao(indexPlayer, caiPiao, type)); //pcvr.GetInstance().StartPrintPlayerCaiPiao(indexPlayer, caiPiao); }
void Update() { UpdateDanHuaPingJi(); if (Time.time - m_TimeStart >= m_TimeCreateChouJiang && IsCreateChouJiang == false) { IsCreateChouJiang = true; //创建玩家抽奖界面. if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSPingJiData.PingJiLevel chouJiangPingJi = SSPingJiData.PingJiLevel.A; if (XkGameCtrl.GetInstance() != null && XkGameCtrl.GetInstance().m_PingJiData != null) { chouJiangPingJi = XkGameCtrl.GetInstance().m_PingJiData.m_ChouJiangPingJi; } //是否可以抽奖. IsPlayerCanChouJiang = m_PlayerPingJiLevel < chouJiangPingJi ? false : true; if (IsPlayerCanChouJiang == true) { //淡化隐藏评级界面. StartDanHuaHiddenPingJiPanel(); //允许抽奖时才可以展示抽奖界面. SSUIRoot.GetInstance().m_GameUIManage.CreatPlayerChouJiangUI(m_IndexPlayer, IsPlayerCanChouJiang); } } } if (Time.time - m_TimeStart >= m_TimeHidden && IsRemoveSelf == false && IsPlayerCanChouJiang == false) { //玩家分数不足,无法进行抽奖. SSPingJiData.PingJiLevel chouJiangPingJi = SSPingJiData.PingJiLevel.A; if (XkGameCtrl.GetInstance() != null && XkGameCtrl.GetInstance().m_PingJiData != null) { chouJiangPingJi = XkGameCtrl.GetInstance().m_PingJiData.m_ChouJiangPingJi; } if (m_PlayerPingJiLevel < chouJiangPingJi) { //玩家分数不足,无法进行抽奖. //玩家币值是否足够. bool isPlayerCoinEnough = XKGlobalData.GetPlayerCoinIsEnough(m_IndexPlayer); if (isPlayerCoinEnough == true) { //玩家币值充足. bool isCanXuMing = true; if (XKGlobalData.GetInstance().m_SSGameXuMingData != null) { //当前机位是否可以续命. isCanXuMing = XKGlobalData.GetInstance().m_SSGameXuMingData.GetIsCanXuMing(m_IndexPlayer); } if (isCanXuMing == true) { //玩家可以续命. if (XkGameCtrl.GetIsActivePlayer(m_IndexPlayer) == true) { //玩家首次GG之后,没有设置信息. //设置玩家状态信息. XkGameCtrl.SetActivePlayer(m_IndexPlayer, false); } //是否可以继续进行免费游戏. bool isCanMianFeiPlayGame = false; if (XKGlobalData.GetInstance() != null) { isCanMianFeiPlayGame = XKGlobalData.GetInstance().GetIsCanMianFeiPlayGame(m_IndexPlayer); } if (isCanMianFeiPlayGame == false) { //玩家不可以继续进行免费游戏. //玩家币值充足,需要对微信用户进行扣费. if (pcvr.GetInstance().m_HongDDGamePadInterface != null) { //此时需要对微信付费玩家进行红点点账户扣费. pcvr.GetInstance().m_HongDDGamePadInterface.OnNeedSubPlayerMoney(m_IndexPlayer); } //玩家付费激活游戏. if (pcvr.GetInstance() != null && pcvr.GetInstance().m_HongDDGamePadInterface != null) { //发送玩家付费激活游戏的登录信息给服务器. pcvr.GetInstance().m_HongDDGamePadInterface.SendPlayerFuFeiActiveGameInfoToServer(m_IndexPlayer); } } else { //玩家可以继续进行免费游戏. if (pcvr.GetInstance() != null && pcvr.GetInstance().m_HongDDGamePadInterface != null) { //发送玩家首次免费游戏登录信息给服务器. pcvr.GetInstance().m_HongDDGamePadInterface.SendPlayerShouCiMianFeiInfoToServer(m_IndexPlayer); } //减少玩家免费次数. XKGlobalData.GetInstance().SubMianFeiNum(m_IndexPlayer); } //当前机位续命一次. if (XKGlobalData.GetInstance().m_SSGameXuMingData != null) { XKGlobalData.GetInstance().m_SSGameXuMingData.AddXuMingCount(m_IndexPlayer); } } if (pcvr.GetInstance().m_HongDDGamePadInterface != null) { //此时需要对微信玩家进行的游戏时长信息发送给红点点服务器. pcvr.GetInstance().m_HongDDGamePadInterface.SetPlayerEndGameTime(m_IndexPlayer); } if (SSUIRoot.GetInstance().m_GameUIManage != null) { //删除玩家评级界面. SSUIRoot.GetInstance().m_GameUIManage.RemovePlayerPingJiUI(m_IndexPlayer); } SSPlayerScoreManage playerScoreManage = SSPlayerScoreManage.GetInstance(m_IndexPlayer); if (playerScoreManage != null) { //当删除玩家评级界面的同时重置距玩家还差多少分数. playerScoreManage.OnRemovePlayerPingJiPanel(); } } else { //玩家币值不足. //玩家币值不足,需要对微信用户进行扣费. if (pcvr.GetInstance().m_HongDDGamePadInterface != null) { if (pcvr.GetInstance().m_HongDDGamePadInterface.GetPlayerIsFuFeiActiveGame(m_IndexPlayer) == true) { //付费激活游戏的玩家. //此时需要对微信付费玩家进行红点点账户扣费. pcvr.GetInstance().m_HongDDGamePadInterface.OnNeedSubPlayerMoney(m_IndexPlayer); } } if (pcvr.GetInstance().m_HongDDGamePadInterface != null) { //此时需要对微信玩家进行的游戏时长信息发送给红点点服务器. pcvr.GetInstance().m_HongDDGamePadInterface.SetPlayerEndGameTime(m_IndexPlayer); } //设置玩家状态信息. XkGameCtrl.SetActivePlayer(m_IndexPlayer, false); //玩家评级过低,显示倒计时界面. DaoJiShiCtrl daoJiShiCom = DaoJiShiCtrl.GetInstance(m_IndexPlayer); if (daoJiShiCom != null) { daoJiShiCom.StartPlayDaoJiShi(); } if (SSUIRoot.GetInstance().m_GameUIManage != null) { //删除玩家评级界面. SSUIRoot.GetInstance().m_GameUIManage.RemovePlayerPingJiUI(m_IndexPlayer); } SSPlayerScoreManage playerScoreManage = SSPlayerScoreManage.GetInstance(m_IndexPlayer); if (playerScoreManage != null) { //当删除玩家评级界面的同时重置距玩家还差多少分数. playerScoreManage.OnRemovePlayerPingJiPanel(); } } //if (SSUIRoot.GetInstance().m_GameUIManage != null) //{ // //删除玩家游戏抽奖界面UI. // SSUIRoot.GetInstance().m_GameUIManage.RemovePlayerChouJiangUI(m_IndexPlayer, 0f); //} } //else //{ // //玩家评级达到抽奖水平,显示抽奖界面. // if (SSUIRoot.GetInstance().m_GameUIManage != null) // { // SSUIRoot.GetInstance().m_GameUIManage.CreatPlayerChouJiangUI(m_IndexPlayer); // } //} //if (SSUIRoot.GetInstance().m_GameUIManage != null) //{ // //删除玩家评级界面. // SSUIRoot.GetInstance().m_GameUIManage.RemovePlayerPingJiUI(m_IndexPlayer); //} } }
/// <summary> /// 收到WebSocket网络消息. /// </summary> public void OnMessageReceived(string message) { //SSDebug.LogError("test ---- OnMessageReceived -> message == " + message); //Debug.LogWarning("OnMessageReceived -> message == " + message); if (IsCheckXinTiaoMsg == true) { //心跳消息检测. if (message == m_XinTiaoReturnMsg) { #if UNITY_EDITOR SSDebug.LogWarning("XinTiao Check Success!" + ", time == " + Time.time.ToString("f2")); #endif if (XKGlobalData.GetInstance().IsDebugSocketXiTaoMsg == true) { SSDebug.LogWarning("XinTiao Check Success!" + ", time == " + Time.time.ToString("f2")); } IsCheckXinTiaoMsg = false; m_TimeSendXinTiaoMsg = Time.time; //删除网络故障,请检查网络并重启游戏. if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSUIRoot.GetInstance().m_GameUIManage.RemoveWangLuoGuZhangUI(); } } return; } //JsonData jd = JsonMapper.ToObject(message); //string msgType = jd["type"].ToString(); //switch(msgType) //{ // case "userInfo": //玩家登陆盒子信息. // { // //{"data":{"sex":1,"headUrl":"http://game.hdiandian.com/h5/public/image/head/93124.jpg","userName":"******","userId":"93124"},"type":"userInfo"} // PlayerWeiXinData playerDt = new PlayerWeiXinData(); // playerDt.sex = jd["data"]["sex"].ToString(); // playerDt.headUrl = jd["data"]["headUrl"].ToString(); // playerDt.userName = jd["data"]["userName"].ToString(); // playerDt.userId = Convert.ToInt32(jd["data"]["userId"].ToString()); // OnNetReceivePlayerLoginBoxMsg(playerDt); // break; // } // case "ReleasePlayer": //玩家退出盒子或其他消息. // { // //{"type":"ReleasePlayer","userId":"93124"} // int userId = Convert.ToInt32(jd["userId"].ToString()); // OnNetReceivePlayerExitBoxMsg(userId); // break; // } // case "directionAngle": //手柄方向消息. // { // //{"data":53,"type":"directionAngle","userId":"93124"} // string dirVal = jd["data"].ToString(); // int userId = Convert.ToInt32(jd["userId"].ToString()); // OnNetReceiveDirectionAngleMsg(dirVal, userId); // break; // } // case "actionOperation": //手柄按键消息. // { // //{"data":"fireBUp","type":"actionOperation","userId":"9"} // string btVal = jd["data"].ToString(); // int userId = Convert.ToInt32(jd["userId"].ToString()); // OnNetReceiveActionOperationMsg(btVal, userId); // break; // } //} }
/// <summary> /// 显示战车和boss的飞行彩票. /// </summary> void ShowCaiPiaoZhanCheBossFlyCaiPiao(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState deCaiType, PlayerEnum indexPlayer, Vector3 startPos, SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState daiJinQuanType) { //Debug.LogWarning("Unity: ShowCaiPiaoZhanCheBossFlyCaiPiao -> deCaiType ========= " + deCaiType); if (m_ExplosionPrefab != null) { if (m_ExplosionPoint != null) { startPos = m_ExplosionPoint.transform.position; Destroy(m_ExplosionPoint); } if (deCaiType == SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe) { //只给战车产生爆炸粒子. GameObject objExplode = (GameObject)Instantiate(m_ExplosionPrefab, startPos, Quaternion.identity); objExplode.transform.parent = XkGameCtrl.NpcAmmoArray; XkGameCtrl.CheckObjDestroyThisTimed(objExplode); SSCaiPiaoLiZiManage caiPiaoLiZi = objExplode.GetComponent <SSCaiPiaoLiZiManage>(); if (caiPiaoLiZi != null) { caiPiaoLiZi.ShowNumUI(m_CaiPiaoNum, indexPlayer); } else { Debug.LogWarning("CheckNpcDeathExplode -> caiPiaoLiZi was null................."); } } } if (deCaiType == SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe) { if (XkGameCtrl.GetInstance().m_CaiPiaoFlyData != null) { //初始化飞出的彩票逻辑. XkGameCtrl.GetInstance().m_CaiPiaoFlyData.InitCaiPiaoFly(startPos, indexPlayer, SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe, daiJinQuanType); } else { Debug.LogWarning("CreatLiZi -> m_CaiPiaoFlyData was null............"); } } else if (deCaiType == SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss) { if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSUIRoot.GetInstance().m_GameUIManage.InitCaiPiaoAnimation(XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_JPBossCaiPiaoFlyDt.TimeLeiJiaVal, indexPlayer, deCaiType, SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState.JPBossDaiJinQuan); } if (XkGameCtrl.GetInstance().m_CaiPiaoFlyData != null) { //初始化烟花粒子的产生. XkGameCtrl.GetInstance().m_CaiPiaoFlyData.InitPlayCaiPiaoYanHua(); } else { Debug.LogWarning("CreatLiZi -> m_CaiPiaoFlyData was null............"); } } }