装备系统完结,修复并加入很多
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
public enum ItemRarity
|
||||
{
|
||||
None,
|
||||
Common,
|
||||
Uncommon,
|
||||
Rare,
|
||||
Epic,
|
||||
Legendary,
|
||||
Mythic,
|
||||
Supreme
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfeaeb9d7e9c83d46a665576e90874fe
|
||||
@@ -0,0 +1,33 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0ee00bfb45cf3f044a52640427242c5d, type: 3}
|
||||
m_Name: ItemRarityColorConfig
|
||||
m_EditorClassIdentifier:
|
||||
rarityColors:
|
||||
- rarity: 0
|
||||
color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- rarity: 0
|
||||
color: {r: 0.73, g: 0.73, b: 0.73, a: 1}
|
||||
- rarity: 1
|
||||
color: {r: 0.45, g: 0.82, b: 0.47, a: 1}
|
||||
- rarity: 2
|
||||
color: {r: 0.39, g: 0.63, b: 1, a: 1}
|
||||
- rarity: 3
|
||||
color: {r: 0.72, g: 0.49, b: 0.96, a: 1}
|
||||
- rarity: 4
|
||||
color: {r: 1, g: 0.67, b: 0.29, a: 1}
|
||||
- rarity: 5
|
||||
color: {r: 1, g: 0.84, b: 0.3, a: 1}
|
||||
- rarity: 6
|
||||
color: {r: 1, g: 0.24056602, b: 0.24056602, a: 1}
|
||||
- rarity: 7
|
||||
color: {r: 1, g: 0.5424528, b: 0.64350605, a: 1}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9866db77e3a6bea4f941b4f090f2e75d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "ItemRarityColorConfig", menuName = "Bag/Item Rarity Color Config")]
|
||||
public class ItemRarityColorConfigSO : ScriptableObject
|
||||
{
|
||||
[System.Serializable]
|
||||
public class RarityColorEntry
|
||||
{
|
||||
public ItemRarity rarity = ItemRarity.None;
|
||||
public Color color = Color.white;
|
||||
}
|
||||
|
||||
public List<RarityColorEntry> rarityColors = new List<RarityColorEntry>();
|
||||
|
||||
public Color GetColor(ItemRarity rarity, Color fallback)
|
||||
{
|
||||
for (int i = 0; i < rarityColors.Count; i++)
|
||||
{
|
||||
RarityColorEntry entry = rarityColors[i];
|
||||
if (entry != null && entry.rarity == rarity)
|
||||
{
|
||||
return entry.color;
|
||||
}
|
||||
}
|
||||
|
||||
return fallback;
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
EnsureAllEntries();
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
EnsureAllEntries();
|
||||
}
|
||||
|
||||
private void EnsureAllEntries()
|
||||
{
|
||||
foreach (ItemRarity rarity in System.Enum.GetValues(typeof(ItemRarity)))
|
||||
{
|
||||
bool exists = false;
|
||||
for (int i = 0; i < rarityColors.Count; i++)
|
||||
{
|
||||
if (rarityColors[i] != null && rarityColors[i].rarity == rarity)
|
||||
{
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
rarityColors.Add(new RarityColorEntry { rarity = rarity, color = Color.white });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ee00bfb45cf3f044a52640427242c5d
|
||||
@@ -1,27 +1,200 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class UI_userBag : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 123前言:
|
||||
/// 装备升级、装备熔炼、装备幻化、装备属性转移
|
||||
/// ———————————————————————————————————————
|
||||
/// 升级,每5等级之间使用耗材升级,跨5倍数需要幻化而不是升级;
|
||||
/// 熔炼,消耗多余装备变为碎片,碎片可用于兑换新装备;
|
||||
/// 幻化,改变装备外观,保留原有属性并进行属性加强,消耗幻化材料;
|
||||
/// 属性转移,将一件装备的属性转移到另一件装备上,消耗转移材料;
|
||||
/// 123前言:
|
||||
/// 装备升级、装备熔炼、装备幻化、装备属性转移
|
||||
/// ———————————————————————————————————————
|
||||
/// 升级,每5等级之间使用耗材升级,跨5倍数需要幻化而不是升级;
|
||||
/// 熔炼,消耗多余装备变为碎片,碎片可用于兑换新装备;
|
||||
/// 幻化,改变装备外观,保留原有属性并进行属性加强,消耗幻化材料;
|
||||
/// 属性转移,将一件装备的属性转移到另一件装备上,消耗转移材料;
|
||||
/// </summary>
|
||||
[Header("toggles")]
|
||||
[Header("weapon system")]
|
||||
public ToggleGroup equip_tg;
|
||||
public Toggle equipUpdate;
|
||||
public Toggle equipSmelt;
|
||||
public Toggle equipIllusion;
|
||||
public Toggle equipAttributeTransfer;
|
||||
public Toggle equipAwake;
|
||||
|
||||
[Header("objs")]
|
||||
public GameObject equipUpdateObj;
|
||||
public GameObject equipSmeltObj;
|
||||
public GameObject equipIllusionObj;
|
||||
public GameObject equipAttributeTransferObj;
|
||||
public GameObject equipAwakeObj;
|
||||
|
||||
[Header("filters")]
|
||||
public Dropdown filterDropdown;
|
||||
|
||||
[Header("button")]
|
||||
public Button closeBagButton;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InitializeToggleGroup();
|
||||
BindToggles();
|
||||
SelectDefaultPanel();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
InitializeToggleGroup();
|
||||
BindToggles();
|
||||
SelectDefaultPanel();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
UnbindToggle(equipUpdate, HandleEquipUpdateChanged);
|
||||
UnbindToggle(equipSmelt, HandleEquipSmeltChanged);
|
||||
UnbindToggle(equipIllusion, HandleEquipIllusionChanged);
|
||||
UnbindToggle(equipAttributeTransfer, HandleEquipAttributeTransferChanged);
|
||||
UnbindToggle(equipAwake, HandleEquipAwakeChanged);
|
||||
}
|
||||
|
||||
private void InitializeToggleGroup()
|
||||
{
|
||||
if (equip_tg == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
equip_tg.allowSwitchOff = false;
|
||||
AssignToggleGroup(equipUpdate);
|
||||
AssignToggleGroup(equipSmelt);
|
||||
AssignToggleGroup(equipIllusion);
|
||||
AssignToggleGroup(equipAttributeTransfer);
|
||||
AssignToggleGroup(equipAwake);
|
||||
}
|
||||
|
||||
private void AssignToggleGroup(Toggle toggle)
|
||||
{
|
||||
if (toggle == null || equip_tg == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
toggle.group = equip_tg;
|
||||
}
|
||||
|
||||
private void BindToggles()
|
||||
{
|
||||
RebindToggle(equipUpdate, HandleEquipUpdateChanged);
|
||||
RebindToggle(equipSmelt, HandleEquipSmeltChanged);
|
||||
RebindToggle(equipIllusion, HandleEquipIllusionChanged);
|
||||
RebindToggle(equipAttributeTransfer, HandleEquipAttributeTransferChanged);
|
||||
RebindToggle(equipAwake, HandleEquipAwakeChanged);
|
||||
}
|
||||
|
||||
private void RebindToggle(Toggle toggle, UnityAction<bool> action)
|
||||
{
|
||||
if (toggle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
toggle.onValueChanged.RemoveListener(action);
|
||||
toggle.onValueChanged.AddListener(action);
|
||||
}
|
||||
|
||||
private void UnbindToggle(Toggle toggle, UnityAction<bool> action)
|
||||
{
|
||||
if (toggle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
toggle.onValueChanged.RemoveListener(action);
|
||||
}
|
||||
|
||||
private void SelectDefaultPanel()
|
||||
{
|
||||
if (equipUpdate != null)
|
||||
{
|
||||
equipUpdate.isOn = true;
|
||||
ApplyPanelState(equipUpdateObj);
|
||||
return;
|
||||
}
|
||||
|
||||
ApplyPanelState(null);
|
||||
}
|
||||
|
||||
private void HandleEquipUpdateChanged(bool isOn)
|
||||
{
|
||||
if (isOn)
|
||||
{
|
||||
ApplyPanelState(equipUpdateObj);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleEquipSmeltChanged(bool isOn)
|
||||
{
|
||||
if (isOn)
|
||||
{
|
||||
ApplyPanelState(equipSmeltObj);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleEquipIllusionChanged(bool isOn)
|
||||
{
|
||||
if (isOn)
|
||||
{
|
||||
ApplyPanelState(equipIllusionObj);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleEquipAttributeTransferChanged(bool isOn)
|
||||
{
|
||||
if (isOn)
|
||||
{
|
||||
ApplyPanelState(equipAttributeTransferObj);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleEquipAwakeChanged(bool isOn)
|
||||
{
|
||||
if (isOn)
|
||||
{
|
||||
ApplyPanelState(equipAwakeObj);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyPanelState(GameObject activeObject)
|
||||
{
|
||||
SetObjectActive(equipUpdateObj, activeObject == equipUpdateObj);
|
||||
SetObjectActive(equipSmeltObj, activeObject == equipSmeltObj);
|
||||
SetObjectActive(equipIllusionObj, activeObject == equipIllusionObj);
|
||||
SetObjectActive(equipAttributeTransferObj, activeObject == equipAttributeTransferObj);
|
||||
SetObjectActive(equipAwakeObj, activeObject == equipAwakeObj);
|
||||
|
||||
SetToggleInteractable(equipUpdate, activeObject != equipUpdateObj);
|
||||
SetToggleInteractable(equipSmelt, activeObject != equipSmeltObj);
|
||||
SetToggleInteractable(equipIllusion, activeObject != equipIllusionObj);
|
||||
SetToggleInteractable(equipAttributeTransfer, activeObject != equipAttributeTransferObj);
|
||||
SetToggleInteractable(equipAwake, activeObject != equipAwakeObj);
|
||||
}
|
||||
|
||||
private void SetObjectActive(GameObject target, bool active)
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
target.SetActive(active);
|
||||
}
|
||||
|
||||
private void SetToggleInteractable(Toggle toggle, bool interactable)
|
||||
{
|
||||
if (toggle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
toggle.interactable = interactable;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e0039d3a46af1c458d7f6e2fc72bab2
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,351 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &807996736018548474
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8744455463297095448}
|
||||
- component: {fileID: 6026677002968857109}
|
||||
- component: {fileID: 2076627820454992469}
|
||||
m_Layer: 5
|
||||
m_Name: count
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8744455463297095448
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 807996736018548474}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8166262725233797895}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -19.138, y: -32.499996}
|
||||
m_SizeDelta: {x: 122.675, y: 25}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6026677002968857109
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 807996736018548474}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &2076627820454992469
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 807996736018548474}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 2147483647
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 452fa97492cae71479cf143f29930751, type: 2}
|
||||
m_sharedMaterial: {fileID: -346136068272202111, guid: 452fa97492cae71479cf143f29930751, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 18
|
||||
m_fontSizeBase: 18
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 4
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_TextWrappingMode: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 0
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_EmojiFallbackSupport: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &1539455413490435037
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8166262725233797895}
|
||||
- component: {fileID: 7838302812860657679}
|
||||
- component: {fileID: 4657381606920537637}
|
||||
- component: {fileID: 1300071411499438857}
|
||||
- component: {fileID: 6584228234856549137}
|
||||
m_Layer: 5
|
||||
m_Name: bagItem
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8166262725233797895
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1539455413490435037}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1138651227379855337}
|
||||
- {fileID: 8744455463297095448}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7838302812860657679
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1539455413490435037}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &4657381606920537637
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1539455413490435037}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ff97fbb4cea469343971ba3beb840ba0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
itemIcon: {fileID: 7625100417164316698}
|
||||
itemCount: {fileID: 2076627820454992469}
|
||||
itemBtmImg: {fileID: 1300071411499438857}
|
||||
--- !u!114 &1300071411499438857
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1539455413490435037}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.5754717, g: 0.5754717, b: 0.5754717, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &6584228234856549137
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1539455413490435037}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1300071411499438857}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &2753438770386926317
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1138651227379855337}
|
||||
- component: {fileID: 4379564356498831347}
|
||||
- component: {fileID: 7625100417164316698}
|
||||
m_Layer: 5
|
||||
m_Name: profile
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1138651227379855337
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2753438770386926317}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8166262725233797895}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 90, y: 90}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4379564356498831347
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2753438770386926317}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7625100417164316698
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2753438770386926317}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5a451422b4033245b4f22bb0156cac5
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,48 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class bagItemPreviewPrefab : MonoBehaviour
|
||||
{
|
||||
public Image btm_img;
|
||||
public Image profileImage;
|
||||
public Text itemName;
|
||||
public Text itemToUsing;
|
||||
public Text itemDescription;
|
||||
public TextMeshProUGUI itemAmount;
|
||||
|
||||
public void Bind(Color backgroundColor, Sprite icon, string displayName, string usage, string description, string amountText)
|
||||
{
|
||||
if (btm_img != null)
|
||||
{
|
||||
btm_img.color = backgroundColor;
|
||||
}
|
||||
|
||||
if (profileImage != null)
|
||||
{
|
||||
profileImage.sprite = icon;
|
||||
profileImage.enabled = icon != null;
|
||||
profileImage.color = Color.white;
|
||||
}
|
||||
|
||||
if (itemName != null)
|
||||
{
|
||||
itemName.text = displayName ?? string.Empty;
|
||||
}
|
||||
|
||||
if (itemToUsing != null)
|
||||
{
|
||||
itemToUsing.text = usage ?? string.Empty;
|
||||
}
|
||||
|
||||
if (itemDescription != null)
|
||||
{
|
||||
itemDescription.text = description ?? string.Empty;
|
||||
}
|
||||
|
||||
if (itemAmount != null)
|
||||
{
|
||||
itemAmount.text = amountText ?? string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: efc6c2b42da2e4c4499b4a9af20f0113
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9faca8de160ac842bd1d6f6c86484fe
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b586b5ffb16b1e439280e9ba0fa91ee
|
||||
@@ -0,0 +1,98 @@
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class uBagItemPrefab : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
|
||||
{
|
||||
[Header("ui")]
|
||||
public Image itemIcon;
|
||||
public TMP_Text itemCount;
|
||||
public Image itemBtmImg;
|
||||
|
||||
private uBag owner;
|
||||
private Coroutine hoverRoutine;
|
||||
private float hoverDelaySeconds = 0.5f;
|
||||
|
||||
public void Bind(uBag bagOwner, Sprite icon, string countText, Color backgroundColor, float hoverDelay)
|
||||
{
|
||||
owner = bagOwner;
|
||||
hoverDelaySeconds = hoverDelay > 0f ? hoverDelay : 0.5f;
|
||||
|
||||
if (itemIcon != null)
|
||||
{
|
||||
itemIcon.sprite = icon;
|
||||
itemIcon.enabled = icon != null;
|
||||
itemIcon.color = Color.white;
|
||||
}
|
||||
|
||||
if (itemCount != null)
|
||||
{
|
||||
itemCount.text = countText ?? string.Empty;
|
||||
}
|
||||
|
||||
if (itemBtmImg != null)
|
||||
{
|
||||
itemBtmImg.color = backgroundColor;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (owner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CancelHover();
|
||||
hoverRoutine = StartCoroutine(HoverDelay());
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
CancelHover();
|
||||
if (owner != null)
|
||||
{
|
||||
owner.HidePreviewFor(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
if (owner == null || eventData == null || eventData.button != PointerEventData.InputButton.Left)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
owner.SelectItemForDetail(this);
|
||||
}
|
||||
|
||||
private IEnumerator HoverDelay()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(hoverDelaySeconds);
|
||||
hoverRoutine = null;
|
||||
if (owner != null)
|
||||
{
|
||||
owner.ShowPreviewFor(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
CancelHover();
|
||||
if (owner != null)
|
||||
{
|
||||
owner.HidePreviewFor(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelHover()
|
||||
{
|
||||
if (hoverRoutine != null)
|
||||
{
|
||||
StopCoroutine(hoverRoutine);
|
||||
hoverRoutine = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff97fbb4cea469343971ba3beb840ba0
|
||||
Reference in New Issue
Block a user