//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Thursday, February 28, 2019
|
//--------------------------------------------------------
|
using System;
|
using System.Collections.Generic;
|
using Snxxz.UI;
|
using System.Linq;
|
|
namespace Snxxz.UI
|
{
|
[XLua.LuaCallCSharp]
|
public class AuctionConfigClass
|
{
|
public int JobEntry;//选择职业条目
|
public int TypeEntry;//类型条目
|
public bool JobTipBool;//选择职业条目是否显示
|
public bool TypeTipBool;//类型条目是否显示
|
public AuctionConfig Config;
|
}
|
public class AuctionHelpModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
{
|
public List<AuctionConfig> FullServiceAuctionList = new List<AuctionConfig>();//全服拍卖列表
|
public Dictionary<int, AuctionConfigClass> FullServiceAuctionDic = new Dictionary<int, AuctionConfigClass>();//全服拍卖选择记录
|
public List<AuctionItemConfig> AuctionItemList = new List<AuctionItemConfig>();//拍卖物品表
|
AuctionInquiryModel model { get { return ModelCenter.Instance.GetModel<AuctionInquiryModel>(); } }
|
|
public int AuctionTaxrate1 = 0;//全服拍品税率
|
public int AuctionTaxrate2 = 0;//仙盟拍品税率
|
public int AuctionTaxrate3 = 0;//仙盟拍品个人税率
|
private int selectedGenreNow = 0;
|
public int SelectedGenreNow//当前选择的页签
|
{
|
get { return selectedGenreNow; }
|
set { selectedGenreNow = value; }
|
}
|
private ItemModel itemModel;//当前选择想要上架的物品
|
public ItemModel ItemModel
|
{
|
get { return itemModel; }
|
set { itemModel = value; }
|
}
|
private bool wait = true;
|
public bool Wait
|
{
|
get { return wait; }
|
set { wait = value; }
|
}
|
public override void Init()
|
{
|
var AuctionTaxrateConfig = FuncConfigConfig.Get("AuctionTaxrate");
|
AuctionTaxrate1 = int.Parse(AuctionTaxrateConfig.Numerical1);
|
AuctionTaxrate2 = int.Parse(AuctionTaxrateConfig.Numerical2);
|
AuctionTaxrate3 = int.Parse(AuctionTaxrateConfig.Numerical3);
|
GetAuctionList();
|
AuctionItemList = AuctionItemConfig.GetValues();
|
}
|
|
public void OnBeforePlayerDataInitialize()
|
{
|
GlobalTimeEvent.Instance.secondEvent -= secondEvent;
|
}
|
|
public void OnPlayerLoginOk()
|
{
|
wait = true;
|
GlobalTimeEvent.Instance.secondEvent += secondEvent;
|
}
|
|
|
|
public override void UnInit()
|
{
|
|
}
|
|
private void secondEvent()
|
{
|
if (!wait)
|
{
|
wait = true;
|
}
|
}
|
|
private void GetAuctionList()//全服获取拍卖列表
|
{
|
FullServiceAuctionDic.Clear();
|
var config = AuctionConfig.GetValues();
|
foreach (var value in config)
|
{
|
FullServiceAuctionList.Add(value);
|
if (!FullServiceAuctionDic.ContainsKey(value.Id))
|
{
|
AuctionConfigClass AuctionConfig = new AuctionConfigClass();
|
AuctionConfig.JobEntry = 0;
|
AuctionConfig.TypeEntry = 0;
|
AuctionConfig.JobTipBool = value.ChooseItem1 != null && value.ChooseItem1.Length > 0;
|
AuctionConfig.TypeTipBool = value.ChooseItem2 != null && value.ChooseItem2.Length > 0;
|
AuctionConfig.Config = value;
|
FullServiceAuctionDic.Add(value.Id, AuctionConfig);
|
}
|
}
|
|
}
|
|
public List<AuctionItemConfig> GetAuctionItemList(int index)//获取关注列表
|
{
|
List<AuctionItemConfig> auctionItemList = new List<AuctionItemConfig>();
|
for (int i = 0; i < AuctionItemList.Count; i++)
|
{
|
var auctionItem = AuctionItemList[i];
|
if (auctionItem.ItemType == index)
|
{
|
auctionItemList.Add(auctionItem);
|
}
|
}
|
auctionItemList.Sort(Compare);
|
return auctionItemList;
|
}
|
|
int Compare(AuctionItemConfig x, AuctionItemConfig y)//数组排列
|
{
|
bool havex = IsConcernedAbout(x.ItemID);
|
bool havey = IsConcernedAbout(y.ItemID);
|
if (havex.CompareTo(havey) != 0)
|
{
|
return -havex.CompareTo(havey);
|
}
|
if (x.Sortpriority.CompareTo(y.Sortpriority) != 0)
|
{
|
return x.Sortpriority.CompareTo(y.Sortpriority);
|
}
|
return 1;
|
}
|
|
private bool IsConcernedAbout(int itemID)
|
{
|
bool isBool = false;
|
if (model.AttentionAuctionItemIDdic.ContainsKey(itemID))
|
{
|
isBool = true;
|
}
|
return isBool;
|
}
|
}
|
|
}
|