private void HandleStartGameResult(int id, JsonData msg) { int sceneType = msg.GetInt("m_SceneType"); uint key = msg.GetUint("m_Key"); string ip = msg.GetString("m_ServerIp"); int port = msg.GetInt("m_ServerPort"); int heroId = msg.GetInt("m_HeroId"); int campId = msg.GetInt("m_CampId"); int weaponId = msg.GetInt("m_WeaponId"); int sceneId = msg.GetInt("m_SceneType"); Data_SceneConfig cfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneType); if (null == cfg || cfg.m_Type == (int)SceneTypeEnum.TYPE_PVE) { NetworkSystem.Instance.HeroId = heroId; NetworkSystem.Instance.CampId = campId; NetworkSystem.Instance.SceneId = sceneId; } else { NetworkSystem.Instance.Start(key, ip, port, heroId, campId, sceneId); } GameControler.ChangeScene((int)msg["m_SceneType"]); GfxSystem.GfxLog("HandleStartGameResult"); }
public void InitScene(int sceneId, bool isLock, SubSceneType subType, int grade) { if (sceneId == -1) { NGUITools.SetActive(this.gameObject, false); } else { if (!NGUITools.GetActive(this.gameObject)) { NGUITools.SetActive(this.gameObject, true); } } InitStarArr(); m_SceneId = sceneId; m_SceneGrade = grade; m_SubType = subType; NewLockScene(isLock, sceneId); LockScene(isLock); int bossId = -1; Data_SceneConfig sceneCfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneId); if (null != sceneCfg) { SetSceneName((sceneCfg.m_Order + 1).ToString()); bossId = sceneCfg.m_BossLinkId; } ShowSceneMode(subType, grade, bossId); }
public void SetSourceInfo(int sceneId) { m_SceneId = sceneId; Data_SceneConfig sceneCfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneId); if (sceneCfg == null) { return; } if (lblSceneType != null) { if (sceneCfg.m_SubType == (int)SceneSubTypeEnum.TYPE_ELITE) { string chn_des = StrDictionaryProvider.Instance.GetDictString(158); lblSceneType.text = chn_des; if (spSceneType != null) { spSceneType.spriteName = MasterIcon; } } else { string chn_des = StrDictionaryProvider.Instance.GetDictString(159); lblSceneType.text = chn_des; if (spSceneType != null) { spSceneType.spriteName = CommonIcon; } } } if (lblSceneName != null) { lblSceneName.text = sceneCfg.m_SceneName; } }
//设置章节名 public void SetChapterName(int chapterId) { int sceneId = -1; if (m_ChapterList != null) { for (int index = 0; index < m_ChapterList.Count; ++index) { if (m_ChapterList[index] != null && m_ChapterList[index].m_ChapterId == chapterId) { UICurrentChapter uiChapter = m_ChapterList[index]; int j = 0; for (j = 0; j < uiChapter.sceneArr.Length; ++j) { if (uiChapter.sceneArr[j] != null && uiChapter.sceneArr[j].GetSceneId() != -1) { sceneId = uiChapter.sceneArr[j].GetSceneId(); break; } } if (j < uiChapter.sceneArr.Length) { break; } } } } Data_SceneConfig sceneCfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneId); //todo:根据Id读取章节名 if (lblName != null && sceneCfg != null) { lblName.text = sceneCfg.m_ChapterName; } }
//进入副本 public void OnChallengeBtnClick() { if (m_CompleteCount >= 3 && m_SubSceneType == SubSceneType.Master) { string chn_desc = StrDictionaryProvider.Instance.GetDictString(308); ArkCrossEngine.LogicSystem.EventChannelForGfx.Publish("ge_show_dialog", "ui", chn_desc, "OK", null, null, null, false); return; } //判断是否有匹配 if (WorldSystem.Instance.WaitMatchSceneId > 0) { Data_SceneConfig config = SceneConfigProvider.Instance.GetSceneConfigById(WorldSystem.Instance.WaitMatchSceneId); string str = ArkCrossEngine.StrDictionaryProvider.Instance.Format(852, config.m_SceneName); ArkCrossEngine.LogicSystem.EventChannelForGfx.Publish("ge_screen_tip", "ui", str, UIScreenTipPosEnum.AlignCenter, new UnityEngine.Vector3(0f, 0f, 0f)); return; } RoleInfo role_info = LobbyClient.Instance.CurrentRole; Data_SceneConfig config_data = SceneConfigProvider.Instance.GetSceneConfigById(m_SceneId); if (null != role_info && -1 != m_SceneId && null != config_data) { if (role_info.CurStamina >= config_data.m_CostStamina) { LogicSystem.EventChannelForGfx.Publish("ge_ui_connect_hint", "ui", true, true); } } if (m_SceneId != -1) { ArkCrossEngine.LogicSystem.PublishLogicEvent("ge_select_scene", "lobby", m_SceneId); } else { Debug.LogError("sceneId is -1!!"); } }
//初始化显示的章节 public void StartChapter(int sceneId) { //UIManager.Instance.ShowWindowByName("SceneSelect"); Data_SceneConfig cfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneId); if (cfg != null) { if (cfg.m_Type != c_SinglePVE || cfg.m_Chapter <= 0) { Debug.LogError("!!!Scene type error,sceneId:" + sceneId); return; } if (cfg.m_SubType == (int)SceneSubTypeEnum.TYPE_ELITE) { InitChapters(SubSceneType.Master); CenterOnChild(cfg.m_Chapter); m_TweenSubSceneType = SubSceneType.Master; } else { InitChapters(SubSceneType.Common); m_TweenSubSceneType = SubSceneType.Common; CenterOnChild(cfg.m_Chapter); } AddTweenOnScene(m_CurrentChapterId, sceneId); } else { Debug.Log("Can not get sceneconfig " + sceneId); } }
public bool IsMainciytScene() { Data_SceneConfig cfg = SceneConfigProvider.Instance.GetSceneConfigById(curSceneId); if (cfg != null) { return(cfg.m_Type == (int)SceneTypeEnum.TYPE_PURE_CLIENT_SCENE); } return(false); }
public bool IsArenaPvPScene() { Data_SceneConfig cfg = SceneConfigProvider.Instance.GetSceneConfigById(curSceneId); if (cfg != null) { return(cfg.m_SubType == (int)SceneSubTypeEnum.TYPE_PVAP); } return(false); }
//判断当前场景是否为多人PVE public bool IsMultPveScene() { Data_SceneConfig cfg = SceneConfigProvider.Instance.GetSceneConfigById(curSceneId); if (cfg != null) { return(cfg.m_Type == (int)SceneTypeEnum.TYPE_MULTI_PVE); } return(false); }
private bool CheckMatchingOther() { if (WorldSystem.Instance.WaitMatchSceneId > 0 && WorldSystem.Instance.WaitMatchSceneId != sceneId) { Data_SceneConfig config = SceneConfigProvider.Instance.GetSceneConfigById(WorldSystem.Instance.WaitMatchSceneId); SendScreeTipCenter(852, config.m_SceneName);//正在匹配{0} return(true); } return(false); }
//扫荡事件 public void OnWipeoutBtnClick() { if (m_SubSceneType == SubSceneType.Master) { } RoleInfo role = LobbyClient.Instance.CurrentRole; if (null != role) { ItemDataInfo info = role.GetItemData(ItemConfigProvider.Instance.GetSweepStageItemId(), 0); if (null != info) { Data_SceneConfig sceneCfg = SceneConfigProvider.Instance.GetSceneConfigById(m_SceneId); if (role.CurStamina < sceneCfg.m_CostStamina) { SendDialog(907, 4, null); return; } if (info.ItemNum < 1) { SendDialog(901, 4, null); return; } if (m_SubSceneType == SubSceneType.Common) { if (info.ItemNum >= 1) { LogicSystem.PublishLogicEvent("ge_sweep_stage", "lobby", m_SceneId, 1); return; } } else if (m_SubSceneType == SubSceneType.Master) { if (info.ItemNum >= 1) { int complete_count = role.GetCompletedSceneCount(m_SceneId); if (complete_count < 3) { LogicSystem.PublishLogicEvent("ge_sweep_stage", "lobby", m_SceneId, 1); return; } else { SendDialog(902, 4, null); return; } } } } else { SendDialog(901, 4, null); } } }
//设置通关条件 private void SetAwardCondition(int grade, Data_SceneConfig sceneCfg) { if (sceneCfg == null) { return; } if (grade < 3 && grade >= 0) { string CHN = StrDictionaryProvider.Instance.GetDictString(302); CHN = string.Format(CHN, grade + 1); if (lblConditionNum != null) { lblConditionNum.text = CHN; } switch (grade) { case 0: CHN = StrDictionaryProvider.Instance.GetDictString(303); if (lblAwardCondition != null) { lblAwardCondition.text = CHN; } break; case 1: CHN = StrDictionaryProvider.Instance.GetDictString(304); CHN = string.Format(CHN, sceneCfg.m_CompletedTime); if (lblAwardCondition != null) { lblAwardCondition.text = CHN; } break; case 2: CHN = StrDictionaryProvider.Instance.GetDictString(305); CHN = string.Format(CHN, sceneCfg.m_CompletedHitCount); if (lblAwardCondition != null) { lblAwardCondition.text = CHN; } break; } } else { if (lblConditionNum != null) { lblConditionNum.text = ""; } if (lblAwardCondition != null) { lblAwardCondition.text = ""; } } }
private void InitVictoryPanel(int sceneId, int maxHit, int beHittTimes, int diedTimes, int time, int exp, int gold, bool isFirstComplete) { try { if (texAward != null) { NGUITools.SetActive(texAward.gameObject, false); } m_IsFirstComplete = isFirstComplete; m_SceneId = sceneId; if (lblAwardExp != null) { lblAwardExp.text = "+" + exp.ToString(); } if (lblAwardMoney != null) { lblAwardMoney.text = "+" + gold.ToString(); } values[0] = maxHit; values[1] = beHittTimes; values[2] = diedTimes; values[3] = time; RoleInfo role_info = LobbyClient.Instance.CurrentRole; if (role_info != null) { m_PlayerCurrentLevel = role_info.Level; m_PlayerExp = role_info.Exp; Data_SceneDropOut dropCfg = null; Data_SceneConfig sceneCfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneId); if (sceneCfg != null) { if (sceneCfg.m_SubType == (int)SceneSubTypeEnum.TYPE_ELITE) { subType = SceneSubTypeEnum.TYPE_ELITE; } if (sceneCfg.m_SubType == (int)SceneSubTypeEnum.TYPE_STORY) { subType = SceneSubTypeEnum.TYPE_STORY; } dropCfg = SceneConfigProvider.Instance.GetSceneDropOutById(sceneCfg.m_DropId); } if (dropCfg != null) { m_DropExp = dropCfg.m_Exp; } } UIManager.Instance.ShowWindowByName("VictoryPanel"); } catch (Exception ex) { ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
private void PlayBackgroudMusic() { int scene_id = UIDataCache.Instance.curSceneId; Data_SceneConfig data = SceneConfigProvider.Instance.GetSceneConfigById(scene_id); if (null != data && !(1 == data.m_Type && 0 == data.m_SubType) && !(1 == data.m_Type && 5 == data.m_SubType) && !(3 == data.m_Type && 0 == data.m_SubType)) { PauseOrResumeBackgroudMusic(0, 1); } PauseOrResumeBackgroudMusic(0, 0); }
public bool IsServerSelectScene() { Data_SceneConfig cfg = SceneConfigProvider.Instance.GetSceneConfigById(curSceneId); if (cfg != null) { return(cfg.m_Type == (int)SceneTypeEnum.TYPE_SERVER_SELECT); } else { //第一次登陆时,无法判断该类型 return(true); } }
private void InitBackgroudMusic(int scene_id) { Data_SceneConfig dsc = SceneConfigProvider.Instance.GetSceneConfigById(scene_id); if (null != dsc) { UnityEngine.GameObject go = UnityEngine.GameObject.Find("Audio"); if (null != go) { UnityEngine.AudioSource[] audio_source = go.GetComponents <UnityEngine.AudioSource>(); if (null == audio_source) { return; } for (int i = 0; i < audio_source.Length; i++) { if (null != audio_source[i]) { if (audio_source[i].isPlaying) { continue; } string name = ""; float volume = 1.0f; if (0 == i) { name = dsc.m_BkMusic; volume = dsc.m_BkMusicVolume; } else { name = dsc.m_StoryMusic; volume = dsc.m_StoryMusicVolume; } UnityEngine.AudioClip clip = (UnityEngine.AudioClip)UnityEngine.Resources.Load(name) as UnityEngine.AudioClip; if (null != clip) { audio_source[i].clip = clip; audio_source[i].volume = dsc.m_BkMusicVolume * 0.0f; // tmp disable backgroud music } } } } } }
private void SetAwardItem() { try { RoleInfo role_info = LobbyClient.Instance.CurrentRole; if (role_info != null) { if (role_info.SceneInfo != null && role_info.SceneInfo.ContainsKey(m_SceneId)) { int level = role_info.SceneInfo[m_SceneId];//星级 Data_SceneConfig sceneCfg = SceneConfigProvider.Instance.GetSceneConfigById(m_SceneId); if (sceneCfg == null) { return; } int dropId = sceneCfg.GetCompletedRewardId(level); Data_SceneDropOut dropCfg = SceneConfigProvider.Instance.GetSceneDropOutById(dropId); if (dropCfg != null) { List <int> rewardItemList = dropCfg.GetRewardItemByHeroId(role_info.HeroId); if (null != rewardItemList && rewardItemList.Count > 0) { int itemId = rewardItemList[0]; DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Victory, texAward, itemId, dropCfg.m_ItemCountList[0]); } } } } if (goMasterAward != null) { NGUITools.SetActive(goMasterAward, true); } } catch (System.Exception ex) { ArkCrossEngine.LogicSystem.LogErrorFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
internal void UpdateAttemptAward(ulong guid, int type, int killNpcCount) { UserInfo user = LobbyServer.Instance.DataProcessScheduler.GetUserInfo(guid); if (null == user) { return; } Data_SceneConfig cfg = SceneConfigProvider.Instance.GetSceneConfigById(type); if (null == cfg) { return; } if ((int)SceneTypeEnum.TYPE_MULTI_PVE == cfg.m_Type || (int)SceneSubTypeEnum.TYPE_ATTEMPT == cfg.m_SubType) { if (killNpcCount > user.AttemptAward) { user.AttemptAward = killNpcCount; } } }
internal void RequestSinglePVE(ulong guid, int sceneId) { Data_SceneConfig cfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneId); if (null == cfg || cfg.m_Type == (int)SceneTypeEnum.TYPE_PVE) { //单人pve不建立房间,直接开始游戏(todo:奖励记到人身上[多人的奖励也是这样]) DataProcessScheduler dataProcess = LobbyServer.Instance.DataProcessScheduler; UserInfo user = dataProcess.GetUserInfo(guid); if (user != null) { user.CurrentBattleInfo.init(sceneId, user.HeroId); SyncCombatData(user); JsonMessageWithGuid startGameResultMsg = new JsonMessageWithGuid(JsonMessageID.StartGameResult); startGameResultMsg.m_Guid = user.Guid; ArkCrossEngineMessage.Msg_LC_StartGameResult protoData = new ArkCrossEngineMessage.Msg_LC_StartGameResult(); GeneralOperationResult result = GeneralOperationResult.LC_Succeed; if (user.CurStamina >= cfg.m_CostStamina) { if (!GlobalVariables.Instance.IsDebug) { int preSceneId = SceneConfigProvider.Instance.GetPreSceneId(sceneId); if (-1 != preSceneId) { if (!user.SceneData.ContainsKey(preSceneId)) { LogSystem.Error("player {0} try to enter an Illegal scene {1}", user.Guid, sceneId); return; } } if (cfg.m_SubType == (int)SceneSubTypeEnum.TYPE_ELITE && user.GetCompletedSceneCount(sceneId) >= user.MaxEliteSceneCompletedCount) { LogSystem.Error("player {0} enter an Elite scene {1} too many times {2}", user.Guid, sceneId, user.GetCompletedSceneCount(sceneId)); return; } } protoData.server_ip = "127.0.0.1"; protoData.server_port = 9001; protoData.key = user.Key; protoData.hero_id = user.HeroId; protoData.camp_id = (int)CampIdEnum.Blue; protoData.scene_type = sceneId; protoData.match_key = user.CurrentBattleInfo.MatchKey; result = GeneralOperationResult.LC_Succeed; user.CurrentState = UserState.Pve; } else { result = GeneralOperationResult.LC_Failure_CostError; } protoData.result = (int)result; startGameResultMsg.m_ProtoData = protoData; JsonMessageDispatcher.SendDcoreMessage(user.NodeName, startGameResultMsg); LogSys.Log(LOG_TYPE.INFO, "Single Player Room will run on Lobby without room and roomserver, user {0} scene {1}", guid, sceneId); /// norm log AccountInfo accountInfo = dataProcess.FindAccountInfoById(user.AccountId); if (null != accountInfo) { /// pvefight LogSys.NormLog("PVEfight", LobbyConfig.AppKeyStr, accountInfo.ClientGameVersion, Module.pvefight, LobbyConfig.LogNormVersionStr, "B4110", accountInfo.LogicServerId, accountInfo.AccountId, user.Guid, user.Level, sceneId, (int)FightingType.General, "null", (int)PvefightResult.Failure, "null", "null"); } } } }
public void InitSceneIntroduce(int sceneId, int grade, SubSceneType subType) { try { NGUITools.SetActive(wipePanel, false); NGUITools.SetActive(wipeBtn0.gameObject, false); NGUITools.SetActive(wipeBtn1.gameObject, false); if (subType == SubSceneType.Common) { m_SubSceneType = SubSceneType.Common; for (int i = 0; i < starArr.Length; ++i) { if (starArr[i] != null) { NGUITools.SetActive(starArr[i].gameObject, false); } } RoleInfo role = LobbyClient.Instance.CurrentRole; if (role.SceneInfo.ContainsKey(sceneId)) { NGUITools.SetActive(wipePanel, true); NGUITools.SetActive(wipeBtn0.gameObject, true); NGUITools.SetActive(wipeBtn1.gameObject, true); } } else { m_SubSceneType = SubSceneType.Master; for (int i = 0; i < starArr.Length; ++i) { if (starArr[i] != null) { NGUITools.SetActive(starArr[i].gameObject, true); } if (i < grade) { if (starArr[i] != null) { starArr[i].spriteName = c_BrightStar; } } else { if (starArr[i] != null) { starArr[i].spriteName = c_AshStar; } } } if (grade >= maxStarNum) { NGUITools.SetActive(wipePanel, true); NGUITools.SetActive(wipeBtn0.gameObject, true); NGUITools.SetActive(wipeBtn1.gameObject, true); } } if (uiSceneAward != null) { uiSceneAward.ShowAwardInfo(sceneId, subType, grade); } m_SceneId = sceneId; Data_SceneConfig sceneCfg = SceneConfigProvider.Instance.GetSceneConfigById(m_SceneId); RoleInfo role_info = LobbyClient.Instance.CurrentRole; if (sceneCfg != null) { SetName(sceneCfg.m_SceneName); SetRecommendFight(sceneCfg.m_RecommendFighting); SetCostStatima(sceneCfg.m_CostStamina); if (lblSceneIndex != null) { lblSceneIndex.text = (1 + sceneCfg.m_Order).ToString(); } string des = sceneCfg.m_SceneDescription.Replace("[\\n]", "\n"); if (lblIntroduce1 != null) { lblIntroduce1.text = des; } if (role_info != null) { SetFightingScore((int)role_info.FightingScore); } if (lblCurStamina != null) { lblCurStamina.text = role_info.CurStamina.ToString(); } //设置掉落数据 Data_SceneDropOut dropCfg = SceneConfigProvider.Instance.GetSceneDropOutById(sceneCfg.m_DropId); if (dropCfg != null) { DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Scene_Award, lblAwardExp, DFMItemIconUtils.Instance.m_Exp, dropCfg.m_Exp); DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Scene_Award, lblAwardCoin, DFMItemIconUtils.Instance.m_Money, dropCfg.m_GoldSum); SetAwardItem(dropCfg.GetRewardItemByHeroId(role_info.HeroId), dropCfg.m_ItemCountList); } } InitWipeNum(); InitBtnName(); } catch (Exception ex) { LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
//显示奖励信息 public void ShowAwardInfo(int sceneId, SubSceneType subType, int grade) { Data_SceneConfig sceneCfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneId); if (subType == SubSceneType.Common) { //普通副本 NGUITools.SetActive(goCommonAward, true); NGUITools.SetActive(goMasterAward, false); if (goFinished != null) { if (grade > 0) { NGUITools.SetActive(goFinished, true); } else { NGUITools.SetActive(goFinished, false); } } int dropId = -1; if (sceneCfg == null) { return; } if (sceneCfg.m_CompletedRewards != null && sceneCfg.m_CompletedRewards.Count > 0) { dropId = sceneCfg.m_CompletedRewards[0]; } Data_SceneDropOut dropCfg = SceneConfigProvider.Instance.GetSceneDropOutById(dropId); if (dropCfg != null) { List <int> rewardItemIdList = dropCfg.GetRewardItemByHeroId(LobbyClient.Instance.CurrentRole.HeroId); if (null != rewardItemIdList && rewardItemIdList.Count > 0) { int itemId = rewardItemIdList[0]; if (commonAwardSlot != null) { commonAwardSlot.SetId(itemId); } DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Scene_First, goCommonAward, itemId); } } } else { //精英副本 NGUITools.SetActive(goCommonAward, false); NGUITools.SetActive(goMasterAward, true); if (sceneCfg == null || sceneCfg.m_CompletedRewards == null) { return; } for (int i = 0; i < sceneCfg.m_CompletedRewards.Count; ++i) { int dropId = sceneCfg.m_CompletedRewards[i]; Data_SceneDropOut dropCfg = SceneConfigProvider.Instance.GetSceneDropOutById(dropId); if (dropCfg != null) { List <int> rewardItemIdList = dropCfg.GetRewardItemByHeroId(LobbyClient.Instance.CurrentRole.HeroId); if (null != rewardItemIdList && rewardItemIdList.Count > 0) { int itemId = rewardItemIdList[0]; if (i < masterAwardSlotArr.Length && masterAwardSlotArr[i] != null) { masterAwardSlotArr[i].SetId(itemId); } DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Scene_Star, texItemArr[i], itemId); } } } for (int i = 0; i < spArrowArr.Length; ++i) { if (i + 1 < grade) { if (spArrowArr[i] != null) { spArrowArr[i].spriteName = c_BrightArrow; } } else { if (spArrowArr[i] != null) { spArrowArr[i].spriteName = c_AshArrow; } } } //指示标志 if (grade < 3 && grade >= 0 && lblStarNum != null) { NGUITools.SetActive(goGuide, true); lblStarNum.text = (grade + 1).ToString(); if (grade < m_GuidePosArr.Length) { goGuide.transform.localPosition = m_GuidePosArr[grade]; } } else { NGUITools.SetActive(goGuide, false); } for (int i = 0; i < spFinishedArr.Length; ++i) { if (i < grade) { if (spFinishedArr[i] != null) { NGUITools.SetActive(spFinishedArr[i].gameObject, true); } } else { if (spFinishedArr[i] != null) { NGUITools.SetActive(spFinishedArr[i].gameObject, false); } } } //推荐战力 if (lblRecommendFighting != null) { lblRecommendFighting.text = sceneCfg.m_RecommendFighting.ToString(); } SetAwardCondition(grade, sceneCfg); } }