// ***********************************************************************
// Company :
// Author : Kimch
// Created :
//
// Last Modified By : Kimch
// Last Modified On :
// ***********************************************************************
namespace G
{
using CodeStage.AntiCheat.ObscuredTypes;
using F;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 物品基类
///
public class Item : F.Item.IItem
{
#region CONST
#endregion
#region ENUM
public static class Id
{
public const int kCoin = 1;
public const int kGem = 2;
public const int kAds = 3;
public const int kRmb = 4;
public const int kChip = 5;
public const int kChip2 = 36;
public const int kEnergy = 6;
public const int kGrade = 7;
public const int kExp = 8;
public const int kBeautyLevel = 10;
public const int kBeautyExp = 9;
public const int kStone = 11;
public const int kBattlePassExp = 12;
public const int kBattlePassToken = 13;
public const int kMotility = 17;
///
/// 好友值
///
public const int kFriend = 21;
public const int kLuckyBag = 27;
public const int kAdTicket = 33;
}
public static class Type
{
public const int Money = 1;
public const int Prop = 2;
public const int Weapon = 3;
public const int Equipment = 4;
public const int Gem = 6;
public const int BeautyProp = 8;
}
public static class Quality
{
public const int kMin = 1;
public const int kWhite = 1;
public const int kGreen = 2;
public const int kBlue = 3;
public const int kPurple = 4;
public const int kYellow = 5;
public const int kRed = 6;
public const int kMax = 6;
}
public enum EquipmentType
{
Weapon,
kMax = 6,
}
#endregion
#region Field
public int id
{
get;
protected set;
}
public ItemProp propItem
{
get { return ItemProxy.Instance.GetStaticItem(id); }
}
#endregion
#region MODEL
///
/// 物品信息
///
public struct ItemInfo
{
public int id;
private ObscuredInt _obscuredCount;
public int count
{
get { return _obscuredCount; }
set { _obscuredCount = value; }
}
public ItemProp propItem
{
get { return ItemProxy.Instance.GetStaticItem(id); }
}
public override int GetHashCode()
{
return id;
}
public void Set(int id, int count)
{
this.id = id;
_obscuredCount = count;
}
///
///
///
///
public void Apply(float multiple)
{
_obscuredCount = (int)(count * multiple);
}
///
///
///
///
///
public ItemInfo(int id, int count)
{
this.id = id;
_obscuredCount = count;
}
///
///
///
///
///
///
public static ItemInfo Create(int id, int count)
{
return new ItemInfo { id = id, _obscuredCount = count };
}
public static void FromArray(List results, int[] source, int offset = 0)
{
if (source != null && source.Length > offset)
{
int length = (source.Length - offset) / 2;
for (int i = 0, j = offset; i < length; i++)
{
results.Add(new ItemInfo
{
id = source[j++],
count = source[j++],
});
}
}
}
///
///
///
///
///
///
public static ItemInfo[] FromArray(IList data, int start = 0)
{
if (data != null)
{
int length = data.Count - start;
var ret = new ItemInfo[length / 2];
for (int i = 0, j = start; i < ret.Length; i++)
{
ret[i] = new ItemInfo
{
id = data[j++],
count = data[j++],
};
}
return ret;
}
else
{
return new ItemInfo[0];
}
}
///
///
///
///
///
public static ItemInfo[] FormJsonList(IList