public static UnitEditorUnitMenuManager UnitEditor( IUnitEditorUnitMenuHandler handler, Data_Unit unitData, bool reinforcement = false) { var manager = new UnitEditorUnitMenuManager(handler); Global.test_battler_1 = Test_Battle_Character_Data.from_data( unitData.type, unitData.identifier, unitData.data); if (reinforcement) { Global.test_battler_1.Actor_Id = Global.game_map.last_added_unit.actor.id; } var unitEditor = new Window_Unit_Editor(reinforcement); unitEditor.Confirmed += manager.UnitEditor_Confirmed; unitEditor.Canceled += manager.UnitEditor_Canceled; unitEditor.Closing += manager.UnitEditor_Closing; manager.AddMenu(unitEditor); return(manager); }
protected override void UpdateMenu(bool active) { Window.update(active); if (Window.is_canceled()) { Cancel(); } else if (Window.is_selected()) { if (Window.selected_index() == 0) { Global.game_system.play_se(System_Sounds.Buzzer); } else { if (ReinforcementData.Count == 0) { switch (Window.selected_index()) { case 0: case 3: Global.game_system.play_se(System_Sounds.Buzzer); return; } } Window.greyed_cursor = true; Window.active = false; Window.index = Window.selected_index(); SelectItem(true); } } else if (Global.Input.repeated(Inputs.Left) || Global.Input.repeated(Inputs.Right)) { if (Window.index > 0 && Window.index <= ReinforcementData.Count) { Global.game_system.play_se(System_Sounds.Menu_Move2); Data_Unit unit = ReinforcementData[Window.index - 1]; Test_Battle_Character_Data test_battler = Test_Battle_Character_Data.from_data(unit.type, unit.identifier, unit.data); int team = test_battler.Team; team = new_team(team, Global.Input.repeated(Inputs.Left)); test_battler.Team = team; string[] ary = test_battler.to_string(); ReinforcementData[Window.index - 1] = new Data_Unit(ary[0], ary[1], ary[2]); open_reinforcements_menu(); } // also set scroll, and make the cursor not jump in from the top //Yeti } }
public void PreLoadSceneNpcSkills(int sceneid) { MapDataProvider mdp = SceneConfigProvider.Instance.GetMapDataBySceneResId(sceneid); if (mdp != null) { DataDictionaryMgr <Data_Unit> ddm = mdp.m_UnitMgr; if (ddm != null) { MyDictionary <int, object> dataDic = ddm.GetData(); if (dataDic != null) { List <int> linkidlist = new List <int>(); linkidlist.Clear(); List <int> skilllist = new List <int>(); skilllist.Clear(); foreach (object obj in dataDic.Values) { Data_Unit du = obj as Data_Unit; if (du != null) { if (!linkidlist.Contains(du.m_LinkId)) { linkidlist.Add(du.m_LinkId); } } } foreach (int linkid in linkidlist) { Data_NpcConfig dnc = NpcConfigProvider.Instance.GetNpcConfigById(linkid); if (dnc != null && dnc.m_SkillList != null) { foreach (int skillid in dnc.m_SkillList) { if (!skilllist.Contains(skillid)) { skilllist.Add(skillid); } } } } foreach (int skillid in skilllist) { PreloadNewSkillInstance(skillid); } } } } }
protected void add_unit(Vector2 loc, Data_Unit data, string identifier, int team = -1) { int count = this.units.Count; if (string.IsNullOrEmpty(identifier)) { identifier = data.identifier; } switch (data.type) { case "character": add_character_unit(loc, team, identifier, data.data.Split('\n')); break; case "generic": add_generic_unit(loc, team, identifier, data.data.Split('\n')); break; case "temporary": add_temporary_unit(loc, team, identifier, data.data.Split('\n')); break; } if (this.units.Count > count) { var unit = this.last_added_unit; // If a dead actor, give them 1 hp so they can limp around unless they're a dead PC if (unit.actor.is_out_of_lives() && unit.is_player_team) { unit.hp = 0; } else { unit.actor.hp = Math.Max(1, unit.actor.hp); } unit.actor.setup_items(); unit.actor.staff_fix(); } }
private void SummonPartner() { RoleInfo roleself = LobbyClient.Instance.CurrentRole; if (null == roleself) { return; } roleself.PartnerStateInfo.ActivePartnerHpPercent = 1.0f; if (WorldSystem.Instance.IsPveScene()) { UserInfo playerself = WorldSystem.Instance.GetPlayerSelf(); if (null == playerself) { return; } /// // summonpartner PartnerInfo partnerInfo = roleself.PartnerStateInfo.GetActivePartner(); if (null != partnerInfo && (TimeUtility.GetServerMilliseconds() - playerself.LastSummonPartnerTime > partnerInfo.CoolDown || playerself.LastSummonPartnerTime == 0)) { Data_Unit data = new Data_Unit(); data.m_Id = -1; data.m_LinkId = partnerInfo.LinkId; data.m_CampId = playerself.GetCampId(); data.m_Pos = playerself.GetMovementStateInfo().GetPosition3D(); data.m_RotAngle = 0; data.m_AiLogic = partnerInfo.GetAiLogic(); data.m_AiParam[0] = ""; data.m_AiParam[1] = ""; data.m_AiParam[2] = partnerInfo.GetAiParam().ToString(); data.m_IsEnable = true; NpcInfo npc = WorldSystem.Instance.NpcManager.AddNpc(data); if (null != npc) { AppendAttributeConfig aac = AppendAttributeConfigProvider.Instance.GetDataById(partnerInfo.GetAppendAttrConfigId()); float inheritAttackAttrPercent = partnerInfo.GetInheritAttackAttrPercent(); float inheritDefenceAttrPercent = partnerInfo.GetInheritDefenceAttrPercent(); if (null != aac) { // attack npc.GetBaseProperty().SetAttackBase(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().AttackBase *inheritAttackAttrPercent)); npc.GetBaseProperty().SetFireDamage(Operate_Type.OT_Absolute, playerself.GetActualProperty().FireDamage *inheritAttackAttrPercent); npc.GetBaseProperty().SetIceDamage(Operate_Type.OT_Absolute, playerself.GetActualProperty().IceDamage *inheritAttackAttrPercent); npc.GetBaseProperty().SetPoisonDamage(Operate_Type.OT_Absolute, playerself.GetActualProperty().PoisonDamage *inheritAttackAttrPercent); // defence npc.GetBaseProperty().SetHpMax(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().HpMax *inheritDefenceAttrPercent)); npc.GetBaseProperty().SetEnergyMax(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().EnergyMax *inheritDefenceAttrPercent)); npc.GetBaseProperty().SetADefenceBase(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().ADefenceBase *inheritDefenceAttrPercent)); npc.GetBaseProperty().SetMDefenceBase(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().MDefenceBase *inheritDefenceAttrPercent)); npc.GetBaseProperty().SetFireERD(Operate_Type.OT_Absolute, playerself.GetActualProperty().FireERD *inheritDefenceAttrPercent); npc.GetBaseProperty().SetIceERD(Operate_Type.OT_Absolute, playerself.GetActualProperty().IceERD *inheritDefenceAttrPercent); npc.GetBaseProperty().SetPoisonERD(Operate_Type.OT_Absolute, playerself.GetActualProperty().PoisonERD *inheritDefenceAttrPercent); // reset hp & energy npc.SetHp(Operate_Type.OT_Absolute, npc.GetBaseProperty().HpMax); npc.SetEnergy(Operate_Type.OT_Absolute, npc.GetBaseProperty().EnergyMax); } npc.SetAIEnable(true); npc.GetSkillStateInfo().RemoveAllSkill(); npc.BornTime = TimeUtility.GetServerMilliseconds(); List <int> skillList = partnerInfo.GetSkillList(); if (null != skillList) { for (int i = 0; i < skillList.Count; ++i) { SkillInfo skillInfo = new SkillInfo(skillList[i]); npc.GetSkillStateInfo().AddSkill(skillInfo); } } playerself.LastSummonPartnerTime = TimeUtility.GetServerMilliseconds(); npc.SkillController = new SwordManSkillController(npc, GfxModule.Skill.GfxSkillSystem.Instance); npc.OwnerId = playerself.GetId(); playerself.PartnerId = npc.GetId(); EntityManager.Instance.CreateNpcView(npc.GetId()); if (partnerInfo.BornSkill > 0) { SkillInfo skillInfo = new SkillInfo(partnerInfo.BornSkill); npc.GetSkillStateInfo().AddSkill(skillInfo); npc.SkillController.ForceStartSkill(partnerInfo.BornSkill); } CharacterView view = EntityManager.Instance.GetCharacterViewById(npc.GetId()); if (null != view) { GfxSystem.SetLayer(view.Actor, "PhysicObj"); } GfxSystem.PublishGfxEvent("ge_partner_summon_result", "ui", true); } else { GfxSystem.PublishGfxEvent("ge_partner_summon_result", "ui", false); } } else { GfxSystem.PublishGfxEvent("ge_partner_summon_result", "ui", false); } } if (WorldSystem.Instance.IsPvpScene() || WorldSystem.Instance.IsMultiPveScene()) { NetworkSystem.Instance.SummonPartner(); } }
protected void add_unit(Vector2 loc, Data_Unit data) { add_unit(loc, data, data.identifier); }