public void OnEnable() { props = target as PropsDef; if (props.DedicatedCharacter == null) { props.DedicatedCharacter = new System.Collections.Generic.List <int>(); } dedicatedCharacterCount = props.DedicatedCharacter.Count; dedicatedJobCount = props.DedicatedJob.Count; }
/// <summary> /// 第三个栏位显示,如果是可装备物品,则不显示 /// </summary> /// <param name="def"></param> /// <param name="Usage"></param> /// <returns></returns> private string PropsThirdText(PropsDef def, int Usage) { if (def.EquipItem) { return(" E "); } else { return(Usage + "/" + def.UseNumber); } }
/// <summary> /// 初始化控件中道具的信息显示 /// </summary> /// <param name="index"></param> /// <param name="Prop"></param> public void InitButton(int index, PropsItem Prop) { PropsDef def = Prop.GetDefinition(); Elements[index].Show(index, def.Icon, def.CommonProperty.Name, PropsThirdText(def, Prop.Usage), true); Elements[index].RegisterClickEvent(() => { AddPropToWarehouseAction(Prop); PropsItems.RemoveAt(index); Hide(); }); }
public static PropsDef CreateProps() { int count = ScriptableObjectUtility.GetFoldFileCount(DIRECTORY_PATH); PropsDef props = ScriptableObjectUtility.CreateAsset <PropsDef>( count.ToString(), DIRECTORY_PATH, true ); props.CommonProperty.ID = count; props.CommonProperty.Name = "伤药"; return(props); }
public void Init(CharacterLogic ch, Mode ShowMode = Mode.仅查看武器属性) { this.ShowMode = ShowMode; DisableAllUIElement(); if (ItemsBG != null) { ItemsBG.sprite = ch.characterDef.Portrait; } var item = ch.Info.Items; if (ShowMode <= Mode.择装备的武器) { int itemCount = item.GetWeaponCount(); weaponItems = item.Weapons.ToArray(); int EquipIndex = item.GetEquipIndex(); for (int i = 0; i < itemCount; i++) { WeaponDef def = weaponItems[i].GetDefinition(); string ShowName = EquipIndex == i ? def.CommonProperty.Name + Utils.TextUtil.GetColorString(" E", Color.yellow) : def.CommonProperty.Name; Elements[i].Show(i, def.Icon, ShowName, weaponItems[i].Usage + "/" + Utils.TextUtil.GetColorString(weaponItems[i].GetMaxUsage().ToString(), Color.green), item.IsWeaponEnabled(weaponItems[i].ID), def.Tooltip); } } else { int propsCount = item.GetPropsCount(); propsItems = item.Props.ToArray(); for (int i = 0; i < propsCount; i++) { PropsDef def = propsItems[i].GetDefinition(); Elements[i].Show(i, def.Icon, def.CommonProperty.Name, def.EquipItem ? "<color=green> E </ color > " : weaponItems[i].Usage + "/<color=green>" + +weaponItems[i].GetMaxUsage() + "</color>", true, def.Tooltip); } } }
public PropsItem(int ItemID) { def = ResourceManager.GetPropsDef(ItemID); this.itemID = def.CommonProperty.ID; this.usage = def.UseNumber; }