464 lines
11 KiB
C#
464 lines
11 KiB
C#
|
using System;
|
|||
|
using Thousandto.Cfg.Data;
|
|||
|
using Thousandto.Code.Center;
|
|||
|
|
|||
|
namespace Thousandto.Code.Logic
|
|||
|
{
|
|||
|
//红点条件类型
|
|||
|
public enum RedPointConditionType
|
|||
|
{
|
|||
|
Item, //物品
|
|||
|
FightPower, //战斗力
|
|||
|
Level, //玩家等级
|
|||
|
Task, //完成任务
|
|||
|
Variable, //某个变量
|
|||
|
Custom, //自定义
|
|||
|
XianPo, //仙魄
|
|||
|
TaskSubmit, //提交任务
|
|||
|
Equip, //装备对比
|
|||
|
ChangeJob, //装备对比
|
|||
|
Count
|
|||
|
}
|
|||
|
|
|||
|
public interface RedPointConditionBase
|
|||
|
{
|
|||
|
int ID { get; }
|
|||
|
RedPointConditionType Type { get; }
|
|||
|
bool IsReach { get; }
|
|||
|
}
|
|||
|
|
|||
|
//物品条件,判断物品数量是否满足
|
|||
|
public class RedPointItemCondition : RedPointConditionBase
|
|||
|
{
|
|||
|
public int ItemID { get; private set; }
|
|||
|
public long ItemCount { get; private set; }
|
|||
|
public int CoinID { get; private set; }
|
|||
|
public int Price { get; private set; }
|
|||
|
|
|||
|
public RedPointItemCondition(int itemID, long itemCount, int coinId = 0, int price = 0)
|
|||
|
{
|
|||
|
ItemID = itemID;
|
|||
|
ItemCount = itemCount;
|
|||
|
CoinID = coinId;
|
|||
|
Price = price;
|
|||
|
}
|
|||
|
|
|||
|
public int ID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return ItemID;
|
|||
|
}
|
|||
|
}
|
|||
|
public RedPointConditionType Type
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return RedPointConditionType.Item;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool IsReach
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
var haveCount = GameCenter.ItemContianerSystem.GetItemCountFromCfgId(ItemID);
|
|||
|
if (haveCount >= ItemCount)
|
|||
|
return true;
|
|||
|
else
|
|||
|
{
|
|||
|
if (CoinID > 0)
|
|||
|
{
|
|||
|
var coinCount = GameCenter.ItemContianerSystem.GetItemCountFromCfgId(CoinID);
|
|||
|
return coinCount >= (ItemCount - haveCount) * Price;
|
|||
|
}
|
|||
|
}
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//战斗力条件,判断战斗力是否达成
|
|||
|
public class RedPointFightPowerCondition : RedPointConditionBase
|
|||
|
{
|
|||
|
public int FightPower { get; private set; }
|
|||
|
|
|||
|
public RedPointFightPowerCondition(int fightPower)
|
|||
|
{
|
|||
|
FightPower = fightPower;
|
|||
|
}
|
|||
|
|
|||
|
public int ID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public RedPointConditionType Type
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return RedPointConditionType.FightPower;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool IsReach
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
var lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
|||
|
if (lp != null && lp.FightPower >= FightPower)
|
|||
|
return true;
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//等级条件,判断等级是否达成
|
|||
|
public class RedPointLevelCondition : RedPointConditionBase
|
|||
|
{
|
|||
|
public int Level { get; private set; }
|
|||
|
|
|||
|
public RedPointLevelCondition(int level)
|
|||
|
{
|
|||
|
Level = level;
|
|||
|
}
|
|||
|
|
|||
|
public int ID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public RedPointConditionType Type
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return RedPointConditionType.Level;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool IsReach
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return GameCenter.GameSceneSystem.GetLocalPlayerLevel() >= Level;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//任务条件,判断任务是否完成
|
|||
|
public class RedPointTaskCondition : RedPointConditionBase
|
|||
|
{
|
|||
|
private int _taskID = 0;
|
|||
|
|
|||
|
public RedPointTaskCondition(int taskID)
|
|||
|
{
|
|||
|
_taskID = taskID;
|
|||
|
}
|
|||
|
public RedPointTaskCondition(string taskIDs, char spitChar = '_')
|
|||
|
{
|
|||
|
var taskParams = taskIDs.Split(spitChar);
|
|||
|
if(taskParams.Length >= 2)
|
|||
|
{
|
|||
|
var lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
|||
|
int camp = 0;
|
|||
|
//if(lp != null)
|
|||
|
//{
|
|||
|
// switch(lp.PropMoudle.BirthGroup)
|
|||
|
// {
|
|||
|
// case 1:
|
|||
|
// camp = 0;
|
|||
|
// break;
|
|||
|
// case 2:
|
|||
|
// camp = 1;
|
|||
|
// break;
|
|||
|
// }
|
|||
|
//}
|
|||
|
_taskID = int.Parse(taskParams[camp]);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public int ID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool IsReach
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return GameCenter.TaskManager.IsMainTaskOver(_taskID);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public RedPointConditionType Type
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return RedPointConditionType.Task;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public class RedPointVariableCondition : RedPointConditionBase
|
|||
|
{
|
|||
|
private int _ID;
|
|||
|
private int _value;
|
|||
|
|
|||
|
public RedPointVariableCondition(string need)
|
|||
|
{
|
|||
|
var needParams = need.Split('_');
|
|||
|
if (needParams != null && needParams.Length >= 2)
|
|||
|
{
|
|||
|
int type = 0;
|
|||
|
int value = 0;
|
|||
|
if (int.TryParse(needParams[0], out type) && int.TryParse(needParams[1], out value))
|
|||
|
{
|
|||
|
_ID = type;
|
|||
|
_value = value;
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
_ID = FunctionVariableIdCode.PlayerLevel;
|
|||
|
_value = -1;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public int ID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool IsReach
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return VariableSystem.IsVariableReach(_ID, _value);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public RedPointConditionType Type
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return RedPointConditionType.Variable;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//自定义条件,由外部自定义达成情况
|
|||
|
public class RedPointCustomCondition : RedPointConditionBase
|
|||
|
{
|
|||
|
public bool ShowRedPoint { get; private set; }
|
|||
|
|
|||
|
public RedPointCustomCondition(bool showRedPoint)
|
|||
|
{
|
|||
|
ShowRedPoint = showRedPoint;
|
|||
|
}
|
|||
|
|
|||
|
public int ID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool IsReach
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return ShowRedPoint;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public RedPointConditionType Type
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return RedPointConditionType.Custom;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//仙魄条件,判断仙魄数量是否满足
|
|||
|
public class RedPointXianPoCondition : RedPointConditionBase
|
|||
|
{
|
|||
|
public int ItemID { get; private set; }
|
|||
|
public long ItemCount { get; private set; }
|
|||
|
|
|||
|
public RedPointXianPoCondition(int itemID, long itemCount)
|
|||
|
{
|
|||
|
ItemID = itemID;
|
|||
|
ItemCount = itemCount;
|
|||
|
}
|
|||
|
|
|||
|
public int ID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return ItemID;
|
|||
|
}
|
|||
|
}
|
|||
|
public RedPointConditionType Type
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return RedPointConditionType.XianPo;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool IsReach
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
var haveCount = GameCenter.LuaSystem.Adaptor.GetXianPoCountByCfgId(ItemID);
|
|||
|
if (haveCount >= ItemCount)
|
|||
|
return true;
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//任务可提交条件,判断任务是否可以提交
|
|||
|
public class RedPointTaskSubmitCondition : RedPointConditionBase
|
|||
|
{
|
|||
|
public int TaskId { get; private set; }
|
|||
|
|
|||
|
public RedPointTaskSubmitCondition(int taskId)
|
|||
|
{
|
|||
|
TaskId = taskId;
|
|||
|
}
|
|||
|
|
|||
|
public int ID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return TaskId;
|
|||
|
}
|
|||
|
}
|
|||
|
public RedPointConditionType Type
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return RedPointConditionType.TaskSubmit;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool IsReach
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if(GameCenter.TaskManager.CanSubmitTask(TaskId) && GameCenter.TaskManager.GetBehaviorType(TaskId) != 0)
|
|||
|
return true;
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static class CompaireType
|
|||
|
{
|
|||
|
public const int Dayu = 1;
|
|||
|
public const int Xiaoyu = 2;
|
|||
|
public const int DayuDengyu = 3;
|
|||
|
public const int XiaoyuDengyu = 4;
|
|||
|
public const int Dengyu = 5;
|
|||
|
public const int Budengyu = 6;
|
|||
|
}
|
|||
|
//装备条件,判断是否有更好装备
|
|||
|
public class RedPointEquipCondition : RedPointConditionBase
|
|||
|
{
|
|||
|
public long ItemCount { get; private set; }
|
|||
|
public string ConditionKey { get; private set; }
|
|||
|
|
|||
|
public RedPointEquipCondition(int power = 0, int count = 1, int classLv = 0, int qua = 0, int quaType = 3, int degree = 0, int degType = 3,
|
|||
|
int occ = -1, int occType = 5, int star=0, int starType = 3, string part = "-1")
|
|||
|
{
|
|||
|
if (occ == -1) {
|
|||
|
|
|||
|
var _lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
|||
|
if (_lp != null)
|
|||
|
occ = _lp.IntOcc;
|
|||
|
else
|
|||
|
UnityEngine.Debug.LogError("新建装备红点逻辑错误,没找到lp");
|
|||
|
}
|
|||
|
ItemCount = count;
|
|||
|
ConditionKey = string.Format("{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}_{9}_{10}", qua, quaType, degree, degType, occ, occType, star, starType, power, classLv, part);
|
|||
|
}
|
|||
|
public int ID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
}
|
|||
|
public RedPointConditionType Type
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return RedPointConditionType.Equip;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool IsReach
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
var haveCount = GameCenter.RedPointSystem.EquipConditionsReachCount(ConditionKey);
|
|||
|
if (haveCount >= ItemCount)
|
|||
|
return true;
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
//转职等级条件,判断转职等级是否达成
|
|||
|
public class RedPointChangeJobCondition : RedPointConditionBase
|
|||
|
{
|
|||
|
public int Level { get; private set; }
|
|||
|
|
|||
|
public RedPointChangeJobCondition(int level)
|
|||
|
{
|
|||
|
Level = level;
|
|||
|
}
|
|||
|
|
|||
|
public int ID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public RedPointConditionType Type
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return RedPointConditionType.ChangeJob;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool IsReach
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
var _lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
|||
|
if (_lp != null)
|
|||
|
return _lp.ChangeJobLevel >= Level;
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|