public HeroAdminDevelopVM(HeroAdminCharacter heroAdminCharacter, Action <int> onResetLevelAction) { _heroAdminCharacter = heroAdminCharacter; this._skillVM = new HeroAdminDevelopSkillPerkVM(heroAdminCharacter, onResetLevelAction); this._traitVM = new HeroAdminDevelopTraitsVM(heroAdminCharacter); this._attributeVM = new HeroAdminDevelopAttributeVM(heroAdminCharacter); }
public HeroAdminDevelopSkillPerkVM(HeroAdminCharacter heroAdminCharacter, Action <int> onResetLevelAction) { this._onResetLevelAction = onResetLevelAction; this._heroAdminCharacter = heroAdminCharacter; this._skills = new MBBindingList <HeroAdminSkillVM>(); RefreshHeroSkill(); }
public CharacterCode CreateFrom(HeroAdminCharacter item) { CharacterCode characterCode = CharacterCode.CreateEmpty(); BodyProperties bodyProperties = BodyProperties.Default; BodyProperties.FromString(item.BodyPropertiesString, out bodyProperties); characterCode.BodyProperties = bodyProperties; string text = new Equipment().CalculateEquipmentCode(); ReflectUtils.ReflectPropertyAndSetValue("EquipmentCode", text, characterCode); ReflectUtils.ReflectPropertyAndSetValue("IsHero", true, characterCode); //这个属性影响,如是英雄只会显示头, 不是则显示半身 MBStringBuilder mBStringBuilder = default(MBStringBuilder); mBStringBuilder.Initialize(16, "CreateFrom"); mBStringBuilder.Append <string>("@---@"); mBStringBuilder.Append <string>(text); mBStringBuilder.Append <string>("@---@"); mBStringBuilder.Append <string>(characterCode.BodyProperties.ToString()); mBStringBuilder.Append <string>("@---@"); mBStringBuilder.Append <string>(item.IsFemale ? "1" : "0"); mBStringBuilder.Append <string>("@---@"); mBStringBuilder.Append <string>(characterCode.IsHero ? "1" : "0"); mBStringBuilder.Append <string>("@---@"); mBStringBuilder.Append <string>(((int)characterCode.FormationClass).ToString()); mBStringBuilder.Append <string>("@---@"); mBStringBuilder.Append <string>(characterCode.Color1.ToString()); mBStringBuilder.Append <string>("@---@"); mBStringBuilder.Append <string>(characterCode.Color2.ToString()); mBStringBuilder.Append <string>("@---@"); ReflectUtils.ReflectPropertyAndSetValue("Code", mBStringBuilder.ToStringAndRelease(), characterCode); return(characterCode); }
MBBindingList <HeroAdminAttributeItemVM> _attributes; //成长属性 public HeroAdminDevelopAttributeVM(HeroAdminCharacter hero) { this.hero = hero; this.Level = hero.Level; this._attributes = new MBBindingList <HeroAdminAttributeItemVM>(); RefreshAttribute(); }
public void ExecuteReset() { this._heroAdminCharacter = HeroAdminCharacter.FromHero(this._hero); ///this._heroAdminCharacterVM = new HeroAdminCharacterVM(this._hero); ResetData(); }
public HeroAdminSkillVM(SkillObject skillObject, HeroAdminCharacter hero, Action <HeroAdminSkillVM> onSkillSelection) { this._perks = new MBBindingList <HeroAdminPerkVM>(); this._skillObject = skillObject; this.SkillId = skillObject.StringId; this.NameText = skillObject.Name.ToString(); this.MaxLevel = 300; FillHeroData(hero); this.onSkillSelection = onSkillSelection; }
private void OnHeroSelected(Hero hero) { this._hero = hero; this._heroAdminCharacter = HeroAdminCharacter.FromHero(hero); this._heroAdminCharacterVM.DisplayerHeroName = hero.Name.ToString(); this._heroAdminCharacterVM.RefreshHeroLevel(this._heroAdminCharacter.Level); this._heroAdminCharacterVM.FillFrom(hero.BodyProperties, hero.CharacterObject.FirstBattleEquipment, hero.Culture, hero.IsFemale); this._heroAdminRecordVM.UpdateHeroAdminCharacter(this._heroAdminCharacter); ResetData(); }
public HeroAdminRecordItemVM(HeroAdminCharacter heroAdminCharacter, Action <HeroAdminRecordItemVM> selectAction) { _heroAdminCharacter = heroAdminCharacter; this._onRecordSelected = selectAction; CharacterCode characterCode = CreateFrom(heroAdminCharacter); this.Visual = new ImageIdentifierVM(characterCode); this._skills = new MBBindingList <EncyclopediaSkillVM>(); RefreshHeroSkill(); }
public HereAdminDashBoardVM(Hero hero, Action closeHereAdminDashBoard) { this._HeroAdminHeroSelectorVM = new HeroAdminHeroSelectorVM(hero, OnHeroSelected); this._closeHereAdminDashBoard = closeHereAdminDashBoard; this._hero = hero; this._heroAdminCharacter = HeroAdminCharacter.FromHero(hero); this._heroAdminCharacterVM = new HeroAdminCharacterVM(hero.Name.ToString(), hero.Level); this._heroAdminRecordVM = new HeroAdminRecordVM(this._heroAdminCharacter, this.OnToLoadHeroCharacter); this._heroAdminDevelopVM = new HeroAdminDevelopVM(this._heroAdminCharacter, OnResetLevelAction); this._heroAdminCharacterVM.FillFrom(hero.BodyProperties, hero.CharacterObject.FirstBattleEquipment, hero.Culture, hero.IsFemale); }
public void FillHeroData(HeroAdminCharacter hero) { this._hero = hero; this.CurrentFocusLevel = hero.GetFocusValue(this.Skill); int boundAttributeCurrentValue = hero.GetAttributeValue(this.Skill.CharacterAttributeEnum); TextObject boundAttributeName = CharacterAttributes.GetCharacterAttribute(this.Skill.CharacterAttributeEnum).Name; float num = Campaign.Current.Models.CharacterDevelopmentModel.CalculateLearningRate(boundAttributeCurrentValue, this.CurrentFocusLevel, this.Level, this._hero.Level, boundAttributeName, false).ResultNumber; this.LearningRate = num; this.CanLearnSkill = (num > 0f); this.FullLearningRateLevel = MBMath.Round(Campaign.Current.Models.CharacterDevelopmentModel.CalculateLearningLimit(boundAttributeCurrentValue, this.CurrentFocusLevel, boundAttributeName, false).ResultNumber); this.Level = hero.GetSkillValue(this._skillObject); RefreshPerks(); }
public void OnEnterNameAfter(string saveName) { HeroAdminCharacter data = this._editHero; data.SaveName = saveName; this._data.Insert(0, data); this._genRecordItemVMs.Insert(0, new HeroAdminRecordItemVM(data, OnSelectedItem)); base.OnPropertyChanged("RecordItems"); if (null != this._lastSelectedItem) { this._lastSelectedItem.IsSelected = false; this._lastSelectedItem = null; } GlobalConfigData.Instance.SaveHeroAdminData(); base.OnPropertyChanged("HasSelectedItem"); }
//这是一个点击事件, public void ExecuteLoadSelected() { if (null != this._lastSelectedItem) { TextObject messageObject = new TextObject("", null); //title ,message, 确认按钮,取消按钮 InformationUtils.ShowComfirInformation(new TextObject("{=tips_cr_ConfirmLoad}Confirm to load"), messageObject, () => { HeroAdminCharacter data = this._lastSelectedItem.GetItemData(); data = JsonUtils.DeepCopyByJson(data);//拷贝 String title = new TextObject("{=tips_cr_IncloudBody}Does it contain physical characteristics", null).ToString(); String message = new TextObject("", null).ToString(); InformationManager.ShowInquiry(new InquiryData(title, message, true, true, new TextObject("{=tips_cr_Yes}Yes", null).ToString(), new TextObject("{=tips_cr_No}No", null).ToString(), () => { //是的话 this._onToLoadHeroCharacter(data, true); }, () => { // 否的话 this._onToLoadHeroCharacter(data, false); })); }); } }
private void OnToLoadHeroCharacter(HeroAdminCharacter data, bool include) { if (include) { this._heroAdminCharacter = data; } else { string tmp = this._heroAdminCharacter.BodyPropertiesString; bool isFemale = this._heroAdminCharacter.IsFemale; this._heroAdminCharacter = data; this._heroAdminCharacter.BodyPropertiesString = tmp; this._heroAdminCharacter.IsFemale = isFemale; } //this._heroAdminCharacterVM.RefreshHeroData(); BodyProperties bodyProperties = BodyProperties.Default; BodyProperties.FromString(this._heroAdminCharacter.BodyPropertiesString, out bodyProperties); this._heroAdminCharacterVM.FillFrom(bodyProperties, this._hero.CharacterObject.FirstBattleEquipment, this._hero.Culture, this._heroAdminCharacter.IsFemale); ResetData(); }
public HeroAdminRecordVM(HeroAdminCharacter editHero, Action <HeroAdminCharacter, bool> onToLoadHeroCharacter) { this._editHero = editHero; this._onToLoadHeroCharacter = onToLoadHeroCharacter; this._data = GlobalConfigData.Instance.HeroAdminData();; if (null == this._genRecordItemVMs) { this._genRecordItemVMs = new MBBindingList <HeroAdminRecordItemVM>(); } else { this._genRecordItemVMs.Clear(); } if (null != this._data && this._data.Count > 0) { this._data.ForEach(obj => { this._genRecordItemVMs.Add(new HeroAdminRecordItemVM(obj, OnSelectedItem)); }); } }
public HeroAdminDevelopTraitsVM(HeroAdminCharacter hero) { this._hero = hero; this._traits = new MBBindingList <HeroAdminDevelopTraitItemVM>(); RefreshTraits(); }
public void UpdateHeroAdminCharacter(HeroAdminCharacter newheroAdminCharacter) { this._editHero = newheroAdminCharacter; }