123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System;
- using Newtonsoft;
- using Newtonsoft.Json;
- namespace DataTools
- {
- [System.Serializable]
- public class SerializableColor
- {
- public float R;
- public float G;
- public float B;
- public float A;
- public SerializableColor(Color32 color)
- {
- R = color.r;
- G = color.g;
- B = color.b;
- A = color.a;
- }
- public Color32 GetColor()
- {
- return new Color(R, G, B, A);
- }
- public static implicit operator SerializableColor(Color32 v)
- {
- return new SerializableColor(v);
- }
- }
- [Serializable]
- public class CustomizeItemData
- {
- [SerializeField]
- [JsonProperty]
- private string subCategoryId;
- [SerializeField]
- [JsonProperty]
- private string itemId;
- [SerializeField]
- [JsonProperty]
- //private SerializableColor color32;
- private Color32 color32;
- public CustomizeItemData(string subcategoryid, string itemid, Color32 color32)
- {
- this.subCategoryId = subcategoryid;
- this.itemId = itemid;
- this.color32 = color32;//new SerializableColor(color);
- }
- [JsonIgnore]
- public string SubCategoryId
- {
- get
- {
- return subCategoryId;
- }
- set
- {
- subCategoryId = value;
- }
- }
- [JsonIgnore]
- public string ItemId
- {
- get
- {
- return itemId;
- }
- set
- {
- itemId = value;
- }
- }
- [JsonIgnore]
- public Color32 Color32
- {
- get
- {
- //return color32;
- return color32/*.GetColor()*/;
- }
- set
- {
- color32 = value;
- }
- }
- }
- }
|