/// <summary> /// 加载服务器列表 /// </summary> public static void LoadServerList() { try { List <ServerInfo> servers; var url = GetCfgInfoUrlByName("ServerList"); string xmlSerList = ""; if (!string.IsNullOrEmpty(url)) { xmlSerList = DownloadMgr.Instance.DownLoadHtml(url); } servers = LoadXMLText <ServerInfo>(xmlSerList); if (servers.Count != 0) { ServerList = servers; } for (int i = 0; i < ServerList.Count; i++) { if (ServerList[i].id == LocalSetting.SelectedServer) { SelectedServerIndex = ServerList[i].id; break; } } } catch (Exception e) { m_log.Error(e.ToString()); } }
public void ConfirmBeast(long beastId) { PlayerData playerData = this.GetPlayerData(beastId); BeastData beastData = this.GetBeastData(beastId); if (playerData != null && beastData != null) { if (this.m_dicPlayerInGameBeastData.ContainsKey(playerData.PlayerId)) { this.m_dicPlayerInGameBeastData[playerData.PlayerId].Add(beastData); } else { m_log.Error("没有找到玩家ID对应的神兽数据"); } DataBeastlist dataList = null; GameData <DataBeastlist> .dataMap.TryGetValue(beastData.BeastTypeId, out dataList); if (dataList != null) { DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.OnRecvChat(playerData.Name, dataList.Name, dataList.NickName, beastData.IsRandom, playerData.CampType); DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.ShowCampTypeEffect(beastId); } } }
private StoryInstanceInfo NewStoryInstance(int storyId) { StoryInstanceInfo instInfo = GetUnusedStoryInstanceInfoFromPool(storyId); if (instInfo == null) { //这里应该是现在角色所在的场景id DataSceneConfig cfg = GameData <DataSceneConfig> .dataMap[0]; if (cfg != null) { string[] filePath = new string[1] { cfg.StoryDSLFile }; for (int i = 0; i < 1; i++) { filePath[i] = Application.dataPath + "/Resources/" + cfg.StoryDSLFile; Debug.Log(filePath[i]); } StoryConfigManager.singleton.LoadStoryIfNotExist(storyId, 0, filePath); StoryInstance inst = StoryConfigManager.singleton.NewStoryInstance(storyId, 0); if (inst == null) { m_log.Error("不能加载剧情:" + storyId); return(null); } StoryInstanceInfo info = new StoryInstanceInfo(); info.m_iStoryId = storyId; info.m_oInstance = inst; info.m_bIsUsed = true; AddStoryInstanceInfoToPool(storyId, info); return(info); } else { m_log.Error("不能找到剧情" + storyId + "配置文件"); return(null); } } else { instInfo.m_bIsUsed = true; return(instInfo); } }
/// <summary> /// 点击进入游戏按钮(确认选择按钮) /// </summary> /// <param name="button"></param> /// <returns></returns> private bool OnClickEnterGameButton(IXUIButton button) { //取得选择角色的id,然后发送给服务器 if (this.SelectRoleId != -65535) { NetworkManager.singleton.SendSelectRole(this.SelectRoleId); } else { m_log.Error("选择角色为空,请重新选择角色"); } return(true); }
/// <summary> /// 创建一个命令 /// </summary> /// <param name="commandConfig"></param> /// <returns></returns> public IStoryCommand CreateCommand(ScriptableData.ISyntaxComponent commandConfig) { IStoryCommand command = null; string type = commandConfig.GetId(); IStoryCommandFactory factory = GetFactory(type); if (factory != null) { command = factory.Create(commandConfig); } else { m_log.Error("创建命令失败,命令类型:" + type); } return(command); }
public Beast(BeastData beastData) { if (null == beastData) { this.m_bIsErrorBeast = true; this.m_skillManager = new SkillGameManager(0); this.m_actWorkManager = new ActWorkManager(); } else { this.m_bIsErrorBeast = false; DataBeastlist dataBeast = null; GameData <DataBeastlist> .dataMap.TryGetValue(beastData.BeastTypeId, out dataBeast); if (dataBeast != null) { this.MaxMoveDis = dataBeast.Move; this.Hp = dataBeast.Hp; if (dataBeast.Skill_1 > 0) { this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_1); } if (dataBeast.Skill_2 > 0) { this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_2); } if (dataBeast.Skill_3 > 0) { this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_3); } if (dataBeast.Skill_4 > 0) { this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_4); } } else { this.m_log.Error(string.Format("null == beastConfig: beastData.BeastTypeId=:{0}", beastData.BeastTypeId)); } this.m_unBeastId = beastData.Id; this.m_unPlayerId = beastData.PlayerId; this.m_dwBeastTypeId = beastData.BeastTypeId; this.m_eCampType = beastData.CampType; this.m_unHp = beastData.Hp; this.m_suitId = beastData.SuitId; this.m_skillManager = new SkillGameManager(this.m_unBeastId); this.m_actWorkManager = new ActWorkManager(); this.m_skillManager.AddSkill(1, false); foreach (var skillData in beastData.Skills) { this.m_skillManager.AddSkill(skillData, false, ESkillActivateType.SKILL_ACTIVATE_TYPE_INVALID); } } DataSkill data = GameData <DataSkill> .dataMap[1]; if (data != null) { int MaxAttackDis = data.UseDis; this.m_nMaxAttackDis = MaxAttackDis; } else { m_log.Error("找不到该技能的配置文件,SKillID:" + 1); } }