UI HUGE UPDATE
This commit is contained in:
@@ -96,6 +96,19 @@ namespace Bansonic
|
||||
SaveRuntimeGeneratedState();
|
||||
}
|
||||
|
||||
public static void SaveRuntimeEquipmentState(equipmentSO equipment)
|
||||
{
|
||||
EnsureRuntimeGeneratedLoaded();
|
||||
if (equipment == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RuntimeGeneratedEquipments.RemoveAll(item => item == null || item == equipment || item.name == equipment.name);
|
||||
RuntimeGeneratedEquipments.Add(equipment);
|
||||
SaveRuntimeGeneratedState();
|
||||
}
|
||||
|
||||
public static void ClearRuntimeGeneratedPersistence()
|
||||
{
|
||||
RuntimeGeneratedEquipments.Clear();
|
||||
|
||||
@@ -265,6 +265,7 @@ public class equipBag : MonoBehaviour
|
||||
private equipmentSO[] LoadEquipments()
|
||||
{
|
||||
var results = new List<equipmentSO>();
|
||||
var indexedByName = new Dictionary<string, int>(StringComparer.Ordinal);
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
@@ -277,15 +278,38 @@ public class equipBag : MonoBehaviour
|
||||
.Where(equipment => equipment != null));
|
||||
}
|
||||
|
||||
for (int i = 0; i < results.Count; i++)
|
||||
{
|
||||
equipmentSO equipment = results[i];
|
||||
if (equipment == null || string.IsNullOrWhiteSpace(equipment.name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
indexedByName[equipment.name] = i;
|
||||
}
|
||||
|
||||
IReadOnlyList<equipmentSO> runtimeGenerated = equipmentGenerator.GetRuntimeGeneratedEquipments();
|
||||
if (runtimeGenerated != null)
|
||||
{
|
||||
for (int i = 0; i < runtimeGenerated.Count; i++)
|
||||
{
|
||||
equipmentSO equipment = runtimeGenerated[i];
|
||||
if (equipment != null && !results.Contains(equipment))
|
||||
if (equipment == null)
|
||||
{
|
||||
results.Add(equipment);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(equipment.name) && indexedByName.TryGetValue(equipment.name, out int existingIndex))
|
||||
{
|
||||
results[existingIndex] = equipment;
|
||||
continue;
|
||||
}
|
||||
|
||||
results.Add(equipment);
|
||||
if (!string.IsNullOrWhiteSpace(equipment.name))
|
||||
{
|
||||
indexedByName[equipment.name] = results.Count - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ public class equipItemPrefab : MonoBehaviour, IBeginDragHandler, IDragHandler, I
|
||||
[Header("info")]
|
||||
public Image itemBtm;
|
||||
public Color[] itemBtmColors;
|
||||
public Sprite[] itemBtmSprites;
|
||||
public Image itemProfileIcon;
|
||||
public string itemType;
|
||||
public string itemName;
|
||||
@@ -74,7 +75,7 @@ public class equipItemPrefab : MonoBehaviour, IBeginDragHandler, IDragHandler, I
|
||||
if (itemSO == null)
|
||||
{
|
||||
ApplyProfileSprite(null);
|
||||
ApplyBottomColor(0);
|
||||
ApplyBottomVisual(0);
|
||||
ApplyEquipperProfile(null);
|
||||
return;
|
||||
}
|
||||
@@ -82,7 +83,7 @@ public class equipItemPrefab : MonoBehaviour, IBeginDragHandler, IDragHandler, I
|
||||
equipmentSO.EquipmentTierPresentation presentation = itemSO.GetVisualTierPresentation();
|
||||
Sprite displaySprite = presentation != null ? presentation.equipmentSprite : null;
|
||||
ApplyProfileSprite(displaySprite);
|
||||
ApplyBottomColor(itemSO.GetVisualQualityColorIndex());
|
||||
ApplyBottomVisual(itemSO.GetVisualQualityColorIndex());
|
||||
ApplyEquipperProfile(FindEquipper(itemSO));
|
||||
}
|
||||
|
||||
@@ -602,21 +603,38 @@ public class equipItemPrefab : MonoBehaviour, IBeginDragHandler, IDragHandler, I
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyBottomColor(int colorIndex)
|
||||
private void ApplyBottomVisual(int colorIndex)
|
||||
{
|
||||
if (itemBtm == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Color color = Color.white;
|
||||
if (itemBtmColors != null && itemBtmColors.Length > 0)
|
||||
itemBtm.sprite = GetBottomSpriteByVisualIndex(colorIndex);
|
||||
itemBtm.color = Color.white;
|
||||
itemBtm.enabled = itemBtm.sprite != null;
|
||||
}
|
||||
|
||||
public Sprite GetBottomSpriteByVisualIndex(int visualIndex)
|
||||
{
|
||||
if (itemBtmSprites == null || itemBtmSprites.Length == 0)
|
||||
{
|
||||
int safeIndex = Mathf.Clamp(colorIndex, 0, itemBtmColors.Length - 1);
|
||||
color = itemBtmColors[safeIndex];
|
||||
return null;
|
||||
}
|
||||
|
||||
itemBtm.color = color;
|
||||
int safeSpriteIndex = Mathf.Clamp(visualIndex, 0, itemBtmSprites.Length - 1);
|
||||
return itemBtmSprites[safeSpriteIndex];
|
||||
}
|
||||
|
||||
public Color GetAccentColorByVisualIndex(int visualIndex)
|
||||
{
|
||||
if (itemBtmColors == null || itemBtmColors.Length == 0)
|
||||
{
|
||||
return Color.white;
|
||||
}
|
||||
|
||||
int safeIndex = Mathf.Clamp(visualIndex, 0, itemBtmColors.Length - 1);
|
||||
return itemBtmColors[safeIndex];
|
||||
}
|
||||
|
||||
private void ApplyEquipperProfile(AllyHero_SO hero)
|
||||
|
||||
@@ -32,10 +32,9 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5614442762582346734}
|
||||
- {fileID: 8306989158517587553}
|
||||
- {fileID: 4501911813970791622}
|
||||
- {fileID: 6659102487498592916}
|
||||
- {fileID: 8306989158517587553}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
@@ -72,6 +71,13 @@ MonoBehaviour:
|
||||
- {r: 1, g: 0.65882355, b: 0.25490198, a: 1}
|
||||
- {r: 1, g: 0.21960784, b: 0.21960784, a: 1}
|
||||
- {r: 1, g: 0.40392157, b: 0.6431373, a: 1}
|
||||
itemBtmSprites:
|
||||
- {fileID: 21300000, guid: 0edbf3fabc7d78e43b1c48516f08667a, type: 3}
|
||||
- {fileID: 21300000, guid: d878370cc5eb0cb409882bb8e6fd7537, type: 3}
|
||||
- {fileID: 21300000, guid: 3ce075becece84045b16ac2fe217f415, type: 3}
|
||||
- {fileID: 21300000, guid: 0eab00cf603f6694c89603352de122e6, type: 3}
|
||||
- {fileID: 21300000, guid: 5ce43da28e0e4464a8a3bd79cfdd18de, type: 3}
|
||||
- {fileID: 21300000, guid: 01f1bbba4db2f5042b08ca58ec475d34, type: 3}
|
||||
itemProfileIcon: {fileID: 1785277191647662279}
|
||||
itemType:
|
||||
itemName:
|
||||
@@ -159,81 +165,6 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &735233510407595243
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5614442762582346734}
|
||||
- component: {fileID: 140358912759755481}
|
||||
- component: {fileID: 1830157142279555648}
|
||||
m_Layer: 5
|
||||
m_Name: backguond
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5614442762582346734
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 735233510407595243}
|
||||
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: 4791772059149409634}
|
||||
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.00012207031, y: 1.2498779}
|
||||
m_SizeDelta: {x: 115, y: 117.5}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &140358912759755481
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 735233510407595243}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1830157142279555648
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 735233510407595243}
|
||||
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.6784314, g: 0.47058827, 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
|
||||
--- !u!1 &5573987670480829073
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -245,14 +176,13 @@ GameObject:
|
||||
- component: {fileID: 8306989158517587553}
|
||||
- component: {fileID: 141289092566972723}
|
||||
- component: {fileID: 7835055449099799467}
|
||||
- component: {fileID: 292496951106862881}
|
||||
m_Layer: 5
|
||||
m_Name: amount
|
||||
m_Name: Text (Legacy)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &8306989158517587553
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -267,11 +197,11 @@ RectTransform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4791772059149409634}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 8.3, y: -5.2}
|
||||
m_SizeDelta: {x: 40, y: 40}
|
||||
m_Pivot: {x: 1, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &141289092566972723
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -293,7 +223,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.9607844, g: 0.9960785, b: 1, a: 1}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
@@ -301,11 +231,11 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: 109b26aefe3036b47959f36a7860ad88, type: 3}
|
||||
m_FontSize: 26
|
||||
m_FontStyle: 1
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 14
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 2
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
@@ -313,22 +243,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: 1
|
||||
--- !u!114 &292496951106862881
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5573987670480829073}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e19747de3f5aca642ab2be37e372fb86, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
|
||||
m_EffectDistance: {x: 2, y: 2}
|
||||
m_UseGraphicAlpha: 1
|
||||
m_Text: Button
|
||||
--- !u!1 &7630186706449988748
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -394,7 +309,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 1859534b1ba2595498f81300a718e9fd, type: 3}
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -421,7 +336,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6659102487498592916
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Bansonic;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
@@ -553,13 +554,12 @@ public class eFinalDream : MonoBehaviour
|
||||
private static Color ResolveEquipmentColor(int colorIndex)
|
||||
{
|
||||
equipItemPrefab reference = Object.FindFirstObjectByType<equipItemPrefab>(FindObjectsInactive.Include);
|
||||
if (reference == null || reference.itemBtmColors == null || reference.itemBtmColors.Length == 0)
|
||||
if (reference == null)
|
||||
{
|
||||
return Color.white;
|
||||
}
|
||||
|
||||
int safeIndex = Mathf.Clamp(colorIndex, 0, reference.itemBtmColors.Length - 1);
|
||||
return reference.itemBtmColors[safeIndex];
|
||||
return reference.GetAccentColorByVisualIndex(colorIndex);
|
||||
}
|
||||
|
||||
private void ClearSpawnedMaterialItems()
|
||||
@@ -639,6 +639,12 @@ public class eFinalDream : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
equipmentGenerator.SaveRuntimeEquipmentState(equipment);
|
||||
return;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
EditorUtility.SetDirty(equipment);
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Bansonic;
|
||||
|
||||
public class equipIllusion : MonoBehaviour
|
||||
{
|
||||
@@ -803,13 +804,12 @@ public class equipIllusion : MonoBehaviour
|
||||
}
|
||||
|
||||
equipItemPrefab itemPrefab = eip.GetComponent<equipItemPrefab>();
|
||||
if (itemPrefab == null || itemPrefab.itemBtmColors == null || itemPrefab.itemBtmColors.Length == 0)
|
||||
if (itemPrefab == null)
|
||||
{
|
||||
return Color.white;
|
||||
}
|
||||
|
||||
int safeIndex = Mathf.Clamp(colorIndex, 0, itemPrefab.itemBtmColors.Length - 1);
|
||||
return itemPrefab.itemBtmColors[safeIndex];
|
||||
return itemPrefab.GetAccentColorByVisualIndex(colorIndex);
|
||||
}
|
||||
|
||||
private static void PersistEquipment(equipmentSO equipment)
|
||||
@@ -819,6 +819,12 @@ public class equipIllusion : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
equipmentGenerator.SaveRuntimeEquipmentState(equipment);
|
||||
return;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorUtility.SetDirty(equipment);
|
||||
if (!Application.isPlaying)
|
||||
|
||||
@@ -840,6 +840,12 @@ public class equipTransfer : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
equipmentGenerator.SaveRuntimeEquipmentState(equipment);
|
||||
return;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
EditorUtility.SetDirty(equipment);
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Bansonic;
|
||||
|
||||
public class equipUpdate : MonoBehaviour
|
||||
{
|
||||
@@ -509,6 +510,12 @@ public class equipUpdate : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
equipmentGenerator.SaveRuntimeEquipmentState(equipment);
|
||||
return;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorUtility.SetDirty(equipment);
|
||||
if (!Application.isPlaying)
|
||||
@@ -538,13 +545,12 @@ public class equipUpdate : MonoBehaviour
|
||||
}
|
||||
|
||||
equipItemPrefab itemPrefab = eip.GetComponent<equipItemPrefab>();
|
||||
if (itemPrefab == null || itemPrefab.itemBtmColors == null || itemPrefab.itemBtmColors.Length == 0)
|
||||
if (itemPrefab == null)
|
||||
{
|
||||
return Color.white;
|
||||
}
|
||||
|
||||
int safeIndex = Mathf.Clamp(colorIndex, 0, itemPrefab.itemBtmColors.Length - 1);
|
||||
return itemPrefab.itemBtmColors[safeIndex];
|
||||
return itemPrefab.GetAccentColorByVisualIndex(colorIndex);
|
||||
}
|
||||
|
||||
private static bool IsLegalLevel(int level)
|
||||
|
||||
Reference in New Issue
Block a user