public MCharacter GetFromBattleNpc(App.Model.Master.MBattleNpc mBattleNpc) { Model.Master.MNpc npc = Get(mBattleNpc.npcId); MCharacter mCharacter = GetFromNpc(npc); if (mBattleNpc.horse > 0) { mCharacter.horse = mBattleNpc.horse; } if (mBattleNpc.weapon > 0) { mCharacter.weapon = mBattleNpc.weapon; } if (mBattleNpc.clothes > 0) { mCharacter.clothes = mBattleNpc.clothes; } if (mBattleNpc.star > 0) { mCharacter.star = mBattleNpc.star; } mCharacter.skills = Service.HttpClient.Deserialize <App.Model.Character.MSkill[]>(mBattleNpc.skills); mCharacter.coordinate.x = mBattleNpc.x; mCharacter.coordinate.y = mBattleNpc.y; return(mCharacter); }
public override void UpdateView() { App.Model.Master.MBattlefield battlefieldMaster = App.Util.Cacher.BattlefieldCacher.Instance.Get(ViewModel.BattlefieldId.Value); title.text = battlefieldMaster.name; num.text = ViewModel.BattlefieldId.Value.ToString(); level.text = string.Format("Lv.{0}", ViewModel.Level.Value); for (int i = 0; i < stars.Length; i++) { Image obj = stars[i]; obj.color = i < ViewModel.Star.Value ? Color.yellow : Color.white; } App.Model.Master.MBattleNpc battleNpc = System.Array.Find(battlefieldMaster.enemys, _ => _.boss == 1); MCharacter mCharacter = NpcCacher.Instance.GetFromBattleNpc(battleNpc); icon.BindingContext = mCharacter.ViewModel; }
public App.Model.MCharacter GetFromBattleNpc(App.Model.Master.MBattleNpc mBattleNpc) { Debug.LogError("mBattleNpc.npc_id =" + mBattleNpc.npc_id); App.Model.Master.MNpc npc = Get(mBattleNpc.npc_id); App.Model.MCharacter mCharacter = GetFromNpc(npc); if (mBattleNpc.horse > 0) { mCharacter.Horse = mBattleNpc.horse; } if (mBattleNpc.weapon > 0) { mCharacter.Weapon = mBattleNpc.weapon; } if (mBattleNpc.clothes > 0) { mCharacter.Clothes = mBattleNpc.clothes; } if (mBattleNpc.star > 0) { mCharacter.Star = mBattleNpc.star; } /*if (mBattleNpc.move_type > 0) * { * mCharacter.MoveType = mBattleNpc.move_type; * } * if (mBattleNpc.weapon_type > 0) * { * mCharacter.WeaponType = mBattleNpc.weapon_type; * }*/ mCharacter.Skills = App.Service.HttpClient.Deserialize <App.Model.MSkill[]>(mBattleNpc.skills); mCharacter.CoordinateX = mBattleNpc.x; mCharacter.CoordinateY = mBattleNpc.y; return(mCharacter); }