// Use this for initialization void Start() { m_model = Context.model; SetModel(m_model); RegisterKeyEventCallback("show_unit_list", () => { m_bEvent = true; }); // ページ切り替え用トグルの設定 Context.Toggle = GetComponent <Toggle>(); ToggleGroup toggleGroup = GetComponentInParent <ToggleGroup>(); if (toggleGroup != null) { Context.Toggle.group = toggleGroup; } // コールバック設定 PartyParamPanel partyParam = GetComponentInParent <PartyParamPanel>(); if (partyParam != null) { Context.Toggle.onValueChanged.AddListener(partyParam.OnChangedPartyParam); } }
// Use this for initialization void Start() { m_model = Context.model; SetModel(m_model); RegisterKeyEventCallback("show_unit_list", () => { new SerialProcess() .Add((System.Action next) => { m_model.ShowUnits(next); }) .Add((System.Action next) => { m_model.ShowSkills(next); }) .Flush(); }); // ページ切り替え用トグルの設定 Context.Toggle = GetComponent <Toggle>(); ToggleGroup toggleGroup = GetComponentInParent <ToggleGroup>(); if (toggleGroup != null) { Context.Toggle.group = toggleGroup; } // コールバック設定 PartyParamQuestPartyPanel partyParam = GetComponentInParent <PartyParamQuestPartyPanel>(); if (partyParam != null) { Context.Toggle.onValueChanged.AddListener(partyParam.OnChangedPartyParam); } }
/// <summary> /// パーティ詳細情報の変更 /// </summary> void CreatePartyParam() { PacketStructUnit[][] partys = UserDataAdmin.Instance.m_StructPartyAssign; m_PartyParamPanel.m_CurrentIndex = m_UnitPartyCurrent; m_PartyParamPanel.PartyParams.Clear(); m_PartyParamPanel.OnChangedPartyParamAction = OnChangedPartyParam; List <MasterDataParamChara> charaMasterList = MasterFinder <MasterDataParamChara> .Instance.FindAll(); m_partyPanels.Clear(); for (int i = 0; i < partys.Length; ++i) { int index = i; var partyPanelModel = new PartyParamListItemModel((uint)index); PartyParamListItemContext paertParam = new PartyParamListItemContext(partyPanelModel); PartySelectGroupUnitContext party = m_PartySelectGroup.GetParty(i); m_partyPanels.Add(partyPanelModel); //-------------------------------------------- // パーティ情報 //-------------------------------------------- if (m_PartyParamPanel != null) { CharaUtil.setupCharaParty(ref paertParam.PartyInfo, party.PartyData); // パーティ情報の設定 paertParam.NameText = string.Format(GameTextUtil.GetText("questlast_text7"), party.Index + 1); paertParam.CostText = string.Format(GameTextUtil.GetText("questlast_text5"), paertParam.PartyInfo.m_PartyTotalCost , UserDataAdmin.Instance.m_StructPlayer.total_party); // Cost paertParam.CharmText = string.Format(GameTextUtil.GetText("questlast_text6"), paertParam.PartyInfo.m_PartyTotalCharm); // CHARM } //------------------------- // ユニット設定 //------------------------- List <PartyMemberUnitContext> unitList = new List <PartyMemberUnitContext>(); int unitDataIndex = 0; for (int pt_count = 0; pt_count < party.PartyData.Length; ++pt_count) { PacketStructUnit unitData = party.PartyData[pt_count]; PacketStructUnit linkData = party.PartyLinkData[pt_count]; var unitDataModel = new PartyMemberUnitListItemModel((uint)unitDataIndex++); PartyMemberUnitContext unit = new PartyMemberUnitContext(unitDataModel); unit.IsActiveStatus = true; unit.IsActiveParamText = true; if (unitData != null) { unit.CharaMaster = charaMasterList.Find((v) => v.fix_id == unitData.id); UnitIconImageProvider.Instance.Get( unitData.id, sprite => { unit.UnitImage = sprite; }); unit.UnitData = unitData; unitDataModel.OnLongPressed += () => { OnLongPressParamUnit(unit); }; } else { unit.OutSideCircleImage = ResourceManager.Instance.Load("icon_circle_deco", ResourceType.Common); unit.UnitImage = ResourceManager.Instance.Load("icon_empty2", ResourceType.Menu); unit.IsEnalbeSelect = true; } if (linkData != null && linkData.id > 0) { unit.LinkCharaMaster = charaMasterList.Find((v) => v.fix_id == linkData.id); UnitIconImageProvider.Instance.Get( linkData.id, sprite => { unit.LinkUnitImage = sprite; }); unit.IsEmptyLinkUnit = false; } else { unit.LinkOutSideCircleImage = ResourceManager.Instance.Load("icon_circle_deco", ResourceType.Common); unit.LinkUnitImage = ResourceManager.Instance.Load("icon_empty2", ResourceType.Menu); unit.IsEmptyLinkUnit = true; } // indexがm_UnitPartyCurrentとその前後の時にアイコンとステータスを更新する. if ((index == m_UnitPartyCurrent) || (index == m_UnitPartyCurrent - 1) || (index == m_UnitPartyCurrent + 1)) { MainMenuUtil.SetPartySelectUnitData(ref unit, unitData, linkData, party.PartyData); } else if (unit.OutSideCircleImage == null) { unit.OutSideCircleImage = ResourceManager.Instance.Load("icon_circle_deco", ResourceType.Common); } unitDataModel.OnClicked += () => { OnSelectParamUnit(unit); }; unitList.Add(unit); partyPanelModel.AddUnit(unitDataModel); } unitList[0].PartyCharaIndex = GlobalDefine.PartyCharaIndex.LEADER; unitList[1].PartyCharaIndex = GlobalDefine.PartyCharaIndex.MOB_1; unitList[2].PartyCharaIndex = GlobalDefine.PartyCharaIndex.MOB_2; unitList[3].PartyCharaIndex = GlobalDefine.PartyCharaIndex.MOB_3; paertParam.Units = unitList; //------------------------- // スキル //------------------------- int skillDataIndex = 0; if (unitList[0].UnitData.id > 0) { List <UnitSkillAtPartyContext> skillList = new List <UnitSkillAtPartyContext>(); var skillDataModel = new ListItemModel((uint)skillDataIndex++); UnitSkillAtPartyContext leaderSkill = new UnitSkillAtPartyContext(skillDataModel); leaderSkill.setupLeaderSkill(unitList[0].CharaMaster.skill_leader); skillList.Add(leaderSkill); paertParam.Skills = skillList; partyPanelModel.AddSkill(skillDataModel); #if BUILD_TYPE_DEBUG Debug.Log("*************** UnitSkillAtPartyContext *********************"); #endif } paertParam.SelectLinkAction = OnSelectLink; m_PartyParamPanel.PartyParams.Add(paertParam); } //-------------------------------------- // 主人公 //-------------------------------------- // アセットバンドルの読み込み uint currentHeroID = MasterDataUtil.GetCurrentHeroID(); AssetBundler.Create(). Set(string.Format("hero_{0:D4}", currentHeroID), (o) => { Texture2D texture = o.GetTexture2D(string.Format("tex_hero_perform_l_{0:D4}", currentHeroID), TextureWrapMode.Clamp); Texture2D texture_mask = o.GetTexture2D(string.Format("tex_hero_perform_l_{0:D4}_mask", currentHeroID), TextureWrapMode.Clamp); foreach (var paertParam in m_PartyParamPanel.PartyParams) { paertParam.HeroImage = texture; paertParam.HeroImage_mask = texture_mask; } }).Load(); }
public PartyParamListItemContext(PartyParamListItemModel model) { m_model = model; }