From 9652722a6d30e9502266e8b9dac704de8ed4f9ec Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期五, 18 一月 2019 10:51:11 +0800
Subject: [PATCH] StrangleGodBoss
---
System/StrangleGodBoss/StrangleGodBossModel.cs | 96 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 96 insertions(+), 0 deletions(-)
diff --git a/System/StrangleGodBoss/StrangleGodBossModel.cs b/System/StrangleGodBoss/StrangleGodBossModel.cs
index b1adcf7..6496be0 100644
--- a/System/StrangleGodBoss/StrangleGodBossModel.cs
+++ b/System/StrangleGodBoss/StrangleGodBossModel.cs
@@ -1,25 +1,121 @@
锘縰sing System.Collections;
using System.Collections.Generic;
using UnityEngine;
+using TableConfig;
+using System;
+
namespace Snxxz.UI
{
public class StrangleGodBossModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
{
+ List<StrangleGodBossData> strangleGodBosses = new List<StrangleGodBossData>();
+
+ public event Action<int> selectBossRefresh;
+
+ int m_SelectBossId = 0;
+ public int selectBossId
+ {
+ get { return m_SelectBossId; }
+ set
+ {
+ if (m_SelectBossId != value)
+ {
+ m_SelectBossId = value;
+ if (selectBossRefresh != null)
+ {
+ selectBossRefresh(value);
+ }
+ }
+ }
+ }
+
+ public int assginSelectBossId { get; set; }
+
public override void Init()
{
+ InitFakeData();
}
public void OnBeforePlayerDataInitialize()
{
+
}
public void OnPlayerLoginOk()
{
+
}
public override void UnInit()
{
+
}
+
+ public bool IsStrangleGodBoss(int bossNpcId)
+ {
+ var index = strangleGodBosses.FindIndex((x) =>
+ {
+ return x.bossNpcId == bossNpcId;
+ });
+ return index >= 0;
+ }
+
+ #region 灞卞鏁版嵁
+ void InitFakeData()
+ {
+ AddFakeData(60203001, 100, 0);
+ AddFakeData(60203002, 130, 0);
+ AddFakeData(60203003, 150, 0);
+ AddFakeData(60203004, 160, 0);
+ AddFakeData(60203005, 180, 0);
+ AddFakeData(60203006, 190, 0);
+ }
+
+ void AddFakeData(int bossNpcId, int level, int score)
+ {
+ var config = Config.Instance.Get<NPCConfig>(bossNpcId);
+ strangleGodBosses.Add(new StrangleGodBossData()
+ {
+ bossNpcId = bossNpcId,
+ challengeCondition = new StrangleGodBossCondition()
+ {
+ level = level,
+ realmLevel = config.Realm,
+ score = score,
+ },
+ });
+ }
+ #endregion
+
+ public static int SortCompare(StrangleGodBossData lhs, StrangleGodBossData rhs)
+ {
+ if (lhs.challengeCondition.level != rhs.challengeCondition.level)
+ {
+ return lhs.challengeCondition.level.CompareTo(rhs.challengeCondition.level);
+ }
+ if (lhs.challengeCondition.realmLevel != rhs.challengeCondition.realmLevel)
+ {
+ return lhs.challengeCondition.realmLevel.CompareTo(rhs.challengeCondition.realmLevel);
+ }
+ if (lhs.challengeCondition.score != rhs.challengeCondition.score)
+ {
+ return lhs.challengeCondition.score.CompareTo(rhs.challengeCondition.score);
+ }
+ return 0;
+ }
+ }
+
+ public struct StrangleGodBossData
+ {
+ public int bossNpcId;
+ public StrangleGodBossCondition challengeCondition;
+ }
+
+ public struct StrangleGodBossCondition
+ {
+ public int level;
+ public int realmLevel;
+ public int score;
}
}
--
Gitblit v1.8.0