public void AddUnit(uint unit_id) { if (unit_id == 0) { return; } DebugGetUnitListItemContext unit = Units.Find((v) => v.unitID == 0); if (unit == null) { return; } MasterDataParamChara charaMaster = MasterDataUtil.GetCharaParamFromID(unit_id); if (charaMaster == null) { return; } unit.unitID = unit_id; unit.UnitName = string.Format("ID:{0}", charaMaster.draw_id); UnitIconImageProvider.Instance.Get( unit_id, sprite => { unit.UnitImage = sprite; }, true); }
public void DeleteUnit(DebugGetUnitListItemContext unit) { unit.unitID = 0; unit.UnitName = ""; UnitIconImageProvider.Instance.GetEmpty(sprite => { unit.UnitImage = sprite; }); }
/// <summary> /// 追加候補のユニットを長押ししたとき /// </summary> /// <param name="unit"></param> void OnLongPressSelectedUnit(DebugGetUnitListItemContext unit) { if (unit.unitID == 0) { return; } if (MainMenuManager.HasInstance) { MainMenuManager.Instance.OpenUnitDetailInfoCatalog(unit.unitID); } }
public void CreateList() { Units.Clear(); DebugGetUnitListItemContext unit; for (int i = 0; i < UNIT_NUM; ++i) { unit = new DebugGetUnitListItemContext(); unit.UnitGetData.level = 1; Units.Add(unit); } }
/// <summary> /// 追加候補のユニットを選択したとき /// </summary> /// <param name="unit"></param> void OnClickSelectedUnit(DebugGetUnitListItemContext unit) { m_DebugGetUnitSelectPanel.DeleteUnit(unit); }
protected override void PageSwitchSetting(bool initalize) { base.PageSwitchSetting(initalize); // TODO: ページ解説テキスト設定 // TODO: タイトル設定 m_DebugGetUnitSelectPanel = m_CanvasObj.GetComponentInChildren <DebugGetUnitSelectPanel>(); m_UnitCatalog = m_CanvasObj.GetComponentInChildren <UnitCatalog>(); if (m_DebugGetUnitSelectPanel != null) { m_DebugGetUnitSelectPanel.Units.Clear(); for (int i = 0; i < UNIT_NUM; i++) { DebugGetUnitListItemContext unit = new DebugGetUnitListItemContext(); unit.ClickAction = OnClickSelectedUnit; unit.LongPressAction = OnLongPressSelectedUnit; m_DebugGetUnitSelectPanel.Units.Add(unit); } m_DebugGetUnitSelectPanel.ClickFixButtonAction = OnClickFixButton; m_DebugGetUnitSelectPanel.ClickResetButtonAction = OnClickResetButton; m_DebugGetUnitSelectPanel.ClickSearchAddButtonAction = OnClickSearchAddButton; m_DebugGetUnitSelectPanel.ResetParam(); if (SafeAreaControl.HasInstance) { float bottom_space_height = SafeAreaControl.Instance.bottom_space_height; if (bottom_space_height > 0) { float height = (bottom_space_height / 2) * -1; m_DebugGetUnitSelectPanel.transform.AddLocalPositionY(height); } } } if (m_UnitCatalog != null) { m_UnitCatalog.SetPositionAjustStatusBar(new Vector2(0, -112f), new Vector2(0, -495f)); m_UnitCatalog.LabelText = ""; m_UnitCatalog.IsActiveLabel = false; if (m_UnitCatalog.MasterCatalogList.Count == 0) { MasterDataParamChara[] charamsterArray = MasterFinder <MasterDataParamChara> .Instance.GetAll(); for (int i = 0; i < charamsterArray.Length; ++i) { if (charamsterArray[i] == null) { continue; } if (charamsterArray[i].fix_id == 0) { continue; } UnitCatalogItemContext unit = new UnitCatalogItemContext(); unit.master = charamsterArray[i]; unit.Index = (int)unit.master.draw_id; unit.DidSelectItem = OnClickUnit; unit.DidLongPressItem = OnLongPressUnit; /* * UnitIconImageProvider.Instance.Get( * unit.master.fix_id, * sprite => * { * unit.IconImage = sprite; * }); */ m_UnitCatalog.MasterCatalogList.Add(unit); } m_UnitCatalog.Init(); } } }