45 lines
1.4 KiB
C#
Executable File
45 lines
1.4 KiB
C#
Executable File
using MongoDB.Bson.Serialization.Attributes;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace ET
|
|
{
|
|
[BsonIgnoreExtraElements]
|
|
public class Store : Entity
|
|
{
|
|
/// <summary>
|
|
/// 第一个int是Index
|
|
/// 第一个int是Id
|
|
/// </summary>
|
|
[BsonDictionaryOptions(MongoDB.Bson.Serialization.Options.DictionaryRepresentation.ArrayOfArrays)]
|
|
public DoubleDictionary<int, int, Item> StoreDic { get; set; } = new DoubleDictionary<int, int, Item>();
|
|
|
|
public const int Slot_PerPage = 60;
|
|
public const int InitMax_Page = 2;
|
|
public int Max_Page = 2;
|
|
public readonly long MaxCoinCount = 9999L * 10000L * 100L * 100L;
|
|
public readonly int InitMaxItemCount = Slot_PerPage * 2;
|
|
public int MaxItemCount = Slot_PerPage * 2;
|
|
public readonly int SortTimeInterval = 60 * 2 * 1000;
|
|
public int ItemCount;
|
|
public long CoinCount;
|
|
public long lastSortTime;
|
|
|
|
[BsonIgnore]
|
|
public bool CanAddNewItem => ItemCount < MaxItemCount;
|
|
|
|
[BsonIgnore]
|
|
public bool isOpenRemote = false;
|
|
public override void EndInit()
|
|
{
|
|
base.EndInit();
|
|
StoreDic.OnDeserialization();
|
|
foreach (var idic in StoreDic)
|
|
{
|
|
idic.Value.index = idic.Key.Key;
|
|
}
|
|
}
|
|
}
|
|
}
|