/// <summary> /// 添加角色到角色总列表 /// </summary> /// <param name="headAdd">添加到列表头部</param> /// <param name="serverGid">服务器gid</param> /// <param name="id">角色uid</param> /// <param name="tid"></param> /// <param name="name"></param> /// <param name="lv"></param> /// <param name="offtime">上次登陆时间</param> /// <param name="pos">位置</param> public void AddCharacter(bool headAdd, string serverGid, ulong id, int tid, string name, int lv, ulong offtime, int pos, int rank) { ServerInfoVO serverInfo = GetServerBy(serverGid); if (serverInfo == null) { return; } if (serverInfo.CharacterList == null) { serverInfo.CharacterList = new List <CharacterVO>(); } CharacterVO player = new CharacterVO(); player.UId = id; player.Name = name; player.Tid = tid; player.Level = lv; player.DanLevel = rank; player.LastLoginTime = (int)offtime; if (headAdd) { serverInfo.CharacterList.Insert(0, player); } else { serverInfo.CharacterList.Add(player); } }
private void LogCharacterParameter(CharacterVO data) { if (data != null) { Debug.Log(string.Format("<color=cyan>id={0}, type={1}, assetName={2}, moveSpeed={3}, baseHp={4}, baseSp={5}, baseAkt={6}, baseDef={7}</color>", data.id, data.type, data.assetName, data.moveSpeed, data.baseHp, data.baseSp, data.baseAtk, data.baseDef)); } }
private void LoadCharacter(string characterId, bool doTransition) { this.CharacterId = characterId; CharacterVO characterVO = Service.StaticDataController.Get <CharacterVO>(characterId); this.characterAssetName = characterVO.AssetName; this.assetManager.Load(ref this.charHandle, this.characterAssetName, new AssetSuccessDelegate(this.OnCharacterLoaded), new AssetFailureDelegate(this.OnCharacterLoadFailed), doTransition); }
/// <summary> /// 更新角色列表 /// </summary> private void UpdateCharacterList(int selectIndex) { List <CharacterVO> datas = m_ServerListProxy.GetLastLoginServer().CharacterList; m_CharacterToggleList.Clear(); // m_CharacterItemRoot.GetComponent<ToggleGroup>().allowSwitchOff = true; //int index = 0; int count = datas != null ? datas.Count : 0; SetHotKeyEnabled("f", datas.Count < 5); m_Title.text = string.Format(TableUtil.GetLanguageString("mailbox_title_1004"), datas.Count, 5); for (int i = 0; i < count; i++) { int sign = i; CharacterVO data = datas[i]; Transform item = sign < m_CharacterItemRoot.childCount ? m_CharacterItemRoot.GetChild(sign) : GameObject.Instantiate(m_CharacterItemPrefab, m_CharacterItemRoot).transform; item.gameObject.SetActive(true); Toggle toggle = null; if (m_EletmentDic.ContainsKey(sign)) { toggle = m_EletmentDic[sign].m_Toggle; m_EletmentDic[sign].InitData(data); } else { Eletment eletment = new Eletment(); eletment.InitEletment(item); eletment.InitData(data); m_EletmentDic.Add(sign, eletment); toggle = eletment.m_Toggle; } toggle.onValueChanged.RemoveAllListeners(); toggle.group = m_CharacterItemRoot.GetComponent <ToggleGroup>(); toggle.group.allowSwitchOff = true; m_CharacterToggleList.Add(toggle); // toggle.isOn = false; m_LastSelectIndex = -1; toggle.onValueChanged.AddListener((select) => { toggle.group.allowSwitchOff = false; OnToggleClick(select, item.gameObject, sign); }); toggle.isOn = false; } for (int i = count; i < m_CharacterItemRoot.childCount; i++) { m_CharacterItemRoot.GetChild(i).GetComponent <Toggle>().onValueChanged.RemoveAllListeners(); m_CharacterItemRoot.GetChild(i).gameObject.SetActive(false); } m_CharacterToggleList[selectIndex].isOn = true; FocusTo(m_CharacterToggleList[selectIndex]); }
/// <summary> /// 获取角色列表中当前选中的角色 /// </summary> /// <returns></returns> public CharacterVO GetCurrentCharacterVO() { if (m_CurrentCharacterVO == null) { m_CurrentCharacterVO = new CharacterVO(); m_CurrentCharacterVO.Tid = (int)GetCfgEternityProxy().GetMalePlayerByIndex(0).Id; } return(m_CurrentCharacterVO); }
private void TryPlayGreet() { if (this.greet) { CharacterVO characterVO = Service.StaticDataController.Get <CharacterVO>(this.Character); if (characterVO.Greets != null) { int num = Service.Rand.ViewRangeInt(0, characterVO.Greets.Length); Service.EventManager.SendEvent(EventId.PlayHoloGreet, characterVO.Greets[num]); } } }
/// <summary> /// Create a new Unit and initialize default equipment and weapons /// </summary> public Unit CreateNewUnit(string unitUID, string characterUID, CombatantFactionEnum faction) { UnitVO unitVO = metadataMap.GetVO <UnitVO>(unitUID); CharacterVO charVO = metadataMap.GetVO <CharacterVO>(characterUID); List <Equipment> defaultEquipment = GetEquipmentListFromUIDs(unitVO.equipmentUIDs); List <Equipment> defaultWeapons = GetEquipmentListFromUIDs(unitVO.weaponsUIDs); Unit unit = new Unit(unitVO, charVO, faction, defaultEquipment, defaultWeapons); return(unit); }
void GrantReward(string[] args) { CommodityType cType = CommodityType.Livre; int val = 0; string id = ""; if (args.Length > 1) { if (!Enum.TryParse <CommodityType>(args[1], ignoreCase: true, out cType)) { error("Can't interpret {0} as a CommodityType.", args[1]); } } if (args.Length == 3) { // "reward CommodityType value" if (!int.TryParse(args[2], out val)) { error("Can't interpret {0} as a number.", args[2]); } } else if (args.Length == 4) { id = args[2]; // "reward CommodityType ID value" if (!int.TryParse(args[3], out val)) { error("Can't interpret {0} as a number.", args[3]); } } else { error("'reward' requires either type and value, or type, ID, and value."); return; } if (cType == CommodityType.Favor) { CharacterVO character = AmbitionApp.GetModel <CharacterModel>().GetCharacter(id); if (character == null) { error("Character '{0}' not found.", id); return; } } AmbitionApp.SendMessage(new CommodityVO(cType, id, val)); }
/// <summary> /// 设置当前创角时 角色信息 /// </summary> public void SetCurrentCharacter() { if (m_CurrentCharacterVO == null) { m_CurrentCharacterVO = new CharacterVO(); } if (m_IsMale) { m_CurrentCharacterVO.Tid = (int)GetCfgEternityProxy().GetMalePlayerByIndex(m_SkinIndex).Id; } else { m_CurrentCharacterVO.Tid = (int)GetCfgEternityProxy().GetFamalePlayerByIndex(m_SkinIndex).Id; } SendNotification(NotificationName.MSG_CHARACTER_CREATE_CURRENT_CHARACTERVO_CHANGE); }
/// <summary> /// 设置当前选中的角色列表中的角色 /// </summary> /// <param name="characterVO"></param> public void SetCurrentCharacterVO(CharacterVO characterVO) { m_CurrentCharacterVO = new CharacterVO(); if (characterVO != null) { m_CurrentCharacterVO.Tid = characterVO.Tid; m_CurrentCharacterVO.UId = characterVO.UId; m_CurrentCharacterVO.Level = characterVO.Level; m_CurrentCharacterVO.DanLevel = characterVO.DanLevel; m_CurrentCharacterVO.LastLoginTime = characterVO.LastLoginTime; m_CurrentCharacterVO.Name = characterVO.Name; } else { m_CurrentCharacterVO.Tid = (int)GetCfgEternityProxy().GetMalePlayerByIndex(0).Id; } SendNotification(NotificationName.MSG_CHARACTER_CREATE_CURRENT_CHARACTERVO_CHANGE); }
public Unit( UnitVO vo, CharacterVO pilot, CombatantFactionEnum faction, List <Equipment> equipment, List <Equipment> weapons) { this.vo = vo; this.pilot = pilot; this.faction = faction; // Initialize the unit with max supplies hp = vo.hp; ammo = vo.ammo; fuel = vo.fuel; this.equipment = equipment; this.weapons = weapons; }
void MakeDateable(string[] args) { if (args.Length <= 1) { error("usage: 'sempai <character_id>' where character_id is a romance option"); } else { CharacterModel model = AmbitionApp.GetModel <CharacterModel>(); CharacterVO character = model.GetCharacter(args[1]); if (character != null) { character.Favor = 100; character.IsDateable = true; character.Acquainted = true; log("{0} is now dateable.", args[1]); } else { error("error: could not find character '{0}'", args[1]); } } }
/// <summary> /// 初始化数据 /// </summary> /// <param name="data">数据</param> public void InitData(CharacterVO data) { m_NameText.text = data.Name; m_LevelText.text = string.Format(TableUtil.GetLanguageString("character_text_1019"), data.Level); }
void SetCommodity(string[] args) { CommodityType cType = CommodityType.Livre; GameModel game = AmbitionApp.GetModel <GameModel>(); int val = 0; string id = ""; if (args.Length > 1) { if (!Enum.TryParse <CommodityType>(args[1], ignoreCase: true, out cType)) { error("Can't interpret {0} as a CommodityType.", args[1]); } } if (args.Length == 3) { // "reward CommodityType value" if (!int.TryParse(args[2], out val)) { error("Can't interpret {0} as a number.", args[2]); } } else if (args.Length == 4) { id = args[2]; // "reward CommodityType ID value" if (!int.TryParse(args[3], out val)) { error("Can't interpret {0} as a number.", args[3]); } } else { error("'set' requires either type and value, or type, ID, and value."); return; } FactionType factionType; FactionVO faction; switch (cType) { case CommodityType.Livre: AmbitionApp.Game.Livre = val; AmbitionApp.SendMessage(GameConsts.LIVRE, val); break; case CommodityType.Exhaustion: AmbitionApp.Game.Exhaustion = val; break; case CommodityType.Credibility: AmbitionApp.Game.Credibility = val; AmbitionApp.SendMessage(GameConsts.CREDIBILITY, val); break; case CommodityType.Peril: AmbitionApp.Game.Peril = val; AmbitionApp.SendMessage(GameConsts.PERIL, val); break; case CommodityType.Power: if (id != null && Enum.TryParse <FactionType>(id, true, out factionType)) { AmbitionApp.Politics.Factions.TryGetValue(factionType, out faction); if (faction != null) { faction.Power = val; } } else { Debug.LogWarning("SetCommodityCmd with FactionPower for unidentified faction "); } break; case CommodityType.Allegiance: if (id != null && Enum.TryParse <FactionType>(id, true, out factionType)) { AmbitionApp.Politics.Factions.TryGetValue(factionType, out faction); if (faction != null) { faction.Allegiance = val; } } else { Debug.LogWarning("SetCommodityCmd with FactionAllegiance for unidentified faction "); } break; case CommodityType.Favor: CharacterVO character = AmbitionApp.GetModel <CharacterModel>().GetCharacter(id); if (character == null) { Debug.LogErrorFormat("Unrecognized character '{0}'", id); } else { character.Favor = val; if (character.Favor < 0) { character.Favor = 0; } else if (character.Favor > 100) { character.Favor = 100; } } break; default: Debug.LogWarningFormat("Don't know how to set commodity type '{0}'", cType); break; } }