686 lines
19 KiB
C#
686 lines
19 KiB
C#
// ***********************************************************************
|
|
// Assembly : Unity
|
|
// Author : Kimch
|
|
// Created : 2019-08-06
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "KGMOptions" company=""></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
#if (UNITY_EDITOR || DEBUG_MY) && !UNITY_WEBGL
|
|
|
|
using System.ComponentModel;
|
|
using UnityEngine;
|
|
|
|
namespace G
|
|
{
|
|
partial class KGMOptions
|
|
{
|
|
[Category("工具"), Sort(0), NumberRange(0, 99999)]
|
|
public int 道具
|
|
{
|
|
get;
|
|
set;
|
|
} = 0;
|
|
|
|
[Category("工具"), Sort(0), NumberRange(0, 100000)]
|
|
public int 道具数量
|
|
{
|
|
get;
|
|
set;
|
|
} = 1;
|
|
|
|
[Category("工具"), Sort(1)]
|
|
public void 增加道具()
|
|
{
|
|
if (道具 > 0)
|
|
{
|
|
var item = ItemProxy.Instance.GetStaticItem<ItemProp>(道具);
|
|
if (item != null)
|
|
{
|
|
if (item.isWeaponOrEquipment)
|
|
ItemProxy.Instance.NewEquipment(item.id);
|
|
else if (item.isGem)
|
|
ItemProxy.Instance.SetGemCount(item.id, 道具数量);
|
|
else if (item.isMoney)
|
|
MoneyProxy.Instance.AddMoney(item.id, 道具数量 - MoneyProxy.Instance.GetMoney(item.id));
|
|
else
|
|
ItemProxy.Instance.SetPropCount(item.id, 道具数量);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var equipmentItems = ItemProxy.Instance.GetStaticItems<ItemEquipment>();
|
|
for (int i = 0; i < 10; i++)
|
|
{
|
|
var eq = equipmentItems[Random.Range(0, equipmentItems.Count)];
|
|
ItemProxy.Instance.NewEquipment(eq.id);
|
|
}
|
|
}
|
|
GlobalNotifier.PostNotification(GlobalDefine.EVENT_EQUIPMENT_GET);
|
|
}
|
|
|
|
[Category("工具"), Sort(2)]
|
|
public void 体力()
|
|
{
|
|
PlayerProxy.Instance.energy = 100;
|
|
}
|
|
|
|
//[Category("工具"), Sort(3)]
|
|
//public void 等级()
|
|
//{
|
|
// PlayerProxy.Instance.grade += 1;
|
|
// GlobalNotifier.PostNotification(GlobalDefine.EVENT_GRADE_CHANGED);
|
|
//}
|
|
//[Category("工具"), Sort(3)]
|
|
//public void 经验()
|
|
//{
|
|
// PlayerProxy.Instance.exp += 10000;
|
|
// GlobalNotifier.PostNotification(GlobalDefine.EVENT_GRADE_CHANGED);
|
|
//}
|
|
|
|
[Category("工具"), Sort(4)]
|
|
public void 金币()
|
|
{
|
|
MoneyProxy.Instance.AddCoin(100000);
|
|
GlobalNotifier.PostNotification(GlobalDefine.EVENT_MONEY_CHANGED);
|
|
}
|
|
|
|
[Category("工具"), Sort(5)]
|
|
public void 晶石()
|
|
{
|
|
MoneyProxy.Instance.AddChip(100000);
|
|
GlobalNotifier.PostNotification(GlobalDefine.EVENT_MONEY_CHANGED);
|
|
}
|
|
|
|
[Category("工具"), Sort(6)]
|
|
public void 陨铁()
|
|
{
|
|
MoneyProxy.Instance.AddStone(100000);
|
|
GlobalNotifier.PostNotification(GlobalDefine.EVENT_MONEY_CHANGED);
|
|
}
|
|
|
|
[Category("工具"), Sort(6)]
|
|
public void 福袋()
|
|
{
|
|
MoneyProxy.Instance.AddMoney(Item.Id.kLuckyBag, 100);
|
|
GlobalNotifier.PostNotification(GlobalDefine.EVENT_MONEY_CHANGED);
|
|
}
|
|
|
|
[Category("工具"), Sort(6)]
|
|
public void 宝石()
|
|
{
|
|
var gems = ItemProxy.Instance.GetStaticItems<ItemGem>();
|
|
foreach (var gem in gems)
|
|
{
|
|
ItemProxy.Instance.AddGem(gem.id, 1);
|
|
}
|
|
GlobalNotifier.PostNotification(GlobalDefine.EVENT_EQUIPMENT_GET);
|
|
}
|
|
|
|
[Category("工具"), Sort(7)]
|
|
public void 阅历()
|
|
{
|
|
VipProxy.Instance.curVip += 1;
|
|
VipProxy.Instance.SaveVip();
|
|
var vipW = KUIWindow.GetWindow<UI.VipWindow>();
|
|
if (vipW != null)
|
|
vipW.RefreshView();
|
|
}
|
|
|
|
[Category("工具"), Sort(5)]
|
|
public void 元宝()
|
|
{
|
|
MoneyProxy.Instance.AddGem(100000);
|
|
GlobalNotifier.PostNotification(GlobalDefine.EVENT_MONEY_CHANGED);
|
|
}
|
|
|
|
[Category("工具"), Sort(9)]
|
|
public void 本地邮件()
|
|
{
|
|
var mails = ItemProxy.Instance.GetStaticItems<ItemMail>();
|
|
MailProxy.Instance.PostLocalMail(mails[0].id);
|
|
}
|
|
|
|
#region 剧情
|
|
|
|
private int _storyEnabled = -1;
|
|
[Category("剧情"), Sort(0)]
|
|
public bool 开关
|
|
{
|
|
get
|
|
{
|
|
if (_storyEnabled == -1)
|
|
{
|
|
_storyEnabled = PlayerPrefs.GetInt("story_switch", 1);
|
|
if (_storyEnabled == 0)
|
|
G.StoryProxy.Instance.storyEnabled = false;
|
|
}
|
|
return _storyEnabled != 0;
|
|
}
|
|
set
|
|
{
|
|
int v = value ? 1 : 0;
|
|
if (_storyEnabled != v)
|
|
{
|
|
_storyEnabled = v;
|
|
StoryProxy.Instance.storyEnabled = value;
|
|
PlayerPrefs.SetInt("story_switch", _storyEnabled);
|
|
PlayerPrefs.Save();
|
|
}
|
|
}
|
|
}
|
|
|
|
[Category("剧情"), Sort(1), NumberRange(1, 99999)]
|
|
public int 剧情
|
|
{
|
|
get;
|
|
set;
|
|
} = 1;
|
|
|
|
[Category("剧情"), Sort(2)]
|
|
public void 开始剧情()
|
|
{
|
|
SRDebug.Instance.HideDebugPanel();
|
|
if (剧情 > 0)
|
|
StoryProxy.Instance.TriggerStory(剧情, null);
|
|
}
|
|
|
|
[Category("剧情"), Sort(3)]
|
|
public int 奇遇ID
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Category("剧情"), Sort(4)]
|
|
public void 触发奇遇()
|
|
{
|
|
var adve = ItemProxy.Instance.GetStaticItem<ItemAdventure>(奇遇ID);
|
|
UI.AdventureBox.ShowAdventure(adve, false, () =>
|
|
{
|
|
Debug.Log($"完成奇遇 {奇遇ID}");
|
|
});
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 学习
|
|
|
|
[Category("武学"), Sort(1)]
|
|
public void 学习武学()
|
|
{
|
|
|
|
}
|
|
|
|
[Category("武学"), Sort(2), NumberRange(101, 100000)]
|
|
public int 书本Id
|
|
{
|
|
get;
|
|
set;
|
|
} = 101;
|
|
|
|
[Category("武学"), Sort(3)]
|
|
public void 解锁书本()
|
|
{
|
|
BookProxy.Instance.UnlockBook(ItemProxy.Instance.GetStaticItem<ItemBook>(书本Id));
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 关卡
|
|
|
|
[Category("关卡"), Sort(1), NumberRange(1, 99999)]
|
|
public int 关卡
|
|
{
|
|
get;
|
|
set;
|
|
} = 1;
|
|
|
|
[Category("关卡"), Sort(2)]
|
|
public void 完成当前()
|
|
{
|
|
var levelItem = ItemProxy.Instance.GetStaticItem<ItemLevel>(关卡);
|
|
if (levelItem != null && !levelItem.isCompleted)
|
|
{
|
|
LevelProxy.Instance.CompleteLevel(levelItem.id, levelItem.maxStage);
|
|
GlobalNotifier.PostNotification(GlobalDefine.EVENT_LEVEL_INFO_CHANGED);
|
|
var mainWindow = KUIWindow.GetWindow<UI.MainWindow>();
|
|
if (mainWindow != null)
|
|
{
|
|
mainWindow.RefreshModel();
|
|
mainWindow.RefreshView();
|
|
}
|
|
}
|
|
关卡 += 1;
|
|
}
|
|
|
|
[Category("关卡"), Sort(3)]
|
|
public void 一键完成()
|
|
{
|
|
for (int i = 1; i <= 关卡; i++)
|
|
{
|
|
var levelItem = ItemProxy.Instance.GetStaticItem<ItemLevel>(关卡);
|
|
if (levelItem != null && !levelItem.isCompleted)
|
|
{
|
|
LevelProxy.Instance.CompleteLevel(levelItem.id, levelItem.maxStage);
|
|
}
|
|
}
|
|
|
|
GlobalNotifier.PostNotification(GlobalDefine.EVENT_LEVEL_INFO_CHANGED);
|
|
var mainWindow = KUIWindow.GetWindow<UI.MainWindow>();
|
|
if (mainWindow != null)
|
|
{
|
|
mainWindow.RefreshModel();
|
|
mainWindow.RefreshView();
|
|
}
|
|
}
|
|
|
|
[Category("关卡"), Sort(4)]
|
|
public void 完成无尽()
|
|
{
|
|
LevelProxy.Instance.CompleteEndlessLevel(关卡);
|
|
}
|
|
|
|
[Category("关卡"), Sort(4)]
|
|
public void 剑阁关()
|
|
{
|
|
LevelProxy.Instance.CompleteClimbLevel(关卡);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 任务
|
|
|
|
[Category("任务"), Sort(1)]
|
|
public int 任务Id
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Category("任务"), Sort(2)]
|
|
public void 完成任务()
|
|
{
|
|
if (任务Id > 0)
|
|
{
|
|
var mission = MissionProxy.Instance.GetMission(任务Id);
|
|
if (mission != null)
|
|
mission.curValue = mission.maxValue;
|
|
}
|
|
}
|
|
|
|
[Category("任务"), Sort(3)]
|
|
public bool 任务跳过完成
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Category("任务"), Sort(4)]
|
|
public void 一键主线()
|
|
{
|
|
while (MissionProxy.Instance.mainMission != null)
|
|
{
|
|
MissionProxy.Instance.mainMission.isRewarded = true;
|
|
}
|
|
}
|
|
|
|
[Category("任务"), Sort(5)]
|
|
public void 打印()
|
|
{
|
|
if (任务Id > 0)
|
|
{
|
|
var mission = MissionProxy.Instance.GetMission(任务Id);
|
|
if (mission != null)
|
|
Debug.Log($"任务 id={mission.id} cur={mission.curValue} max={mission.maxValue} rewarded={mission.isRewarded}");
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 红颜
|
|
|
|
public enum BeautyId
|
|
{
|
|
绾绾 = 1,
|
|
雪玲珑 = 2,
|
|
梦瑶 = 3,
|
|
高语嫣 = 4,
|
|
慕容千凌 = 5,
|
|
秦暮白 = 6,
|
|
尤欢欢 = 7,
|
|
小昭 = 8,
|
|
塔娜 = 9,
|
|
未知 = 10,
|
|
}
|
|
|
|
[Category("红颜&宠物"), Sort(0)]
|
|
public BeautyId 红颜Id
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Category("红颜&宠物"), Sort(1)]
|
|
public void 增加红颜好感()
|
|
{
|
|
var beautyInfo = BeautyProxy.Instance.GetBeauty((int)红颜Id);
|
|
if (beautyInfo != null)
|
|
{
|
|
if (beautyInfo.isUnlock)
|
|
BeautyProxy.Instance.AddFriend(beautyInfo, 1);
|
|
}
|
|
}
|
|
|
|
[Category("红颜&宠物"), NumberRange(12000, 12999), Sort(2)]
|
|
public int 宠物Id
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Category("红颜&宠物"), Sort(3)]
|
|
public void 增加宠物好感()
|
|
{
|
|
var petInfo = PetProxy.Instance.GetPet(宠物Id);
|
|
if (petInfo != null)
|
|
{
|
|
//if (petInfo.isUnlock)
|
|
petInfo.AddFriend(1);
|
|
}
|
|
}
|
|
|
|
[Category("红颜&宠物"), Sort(4)]
|
|
public void 宠物升一级()
|
|
{
|
|
var petInfo = PetProxy.Instance.GetPet(宠物Id);
|
|
if (petInfo != null)
|
|
{
|
|
if (petInfo.isFriend)
|
|
petInfo.AddGrade(1);
|
|
}
|
|
}
|
|
|
|
[Category("红颜&宠物"), Sort(5)]
|
|
public void 宠物升十级()
|
|
{
|
|
var petInfo = PetProxy.Instance.GetPet(宠物Id);
|
|
if (petInfo != null)
|
|
{
|
|
if (petInfo.isFriend)
|
|
petInfo.AddGrade(10);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 录制视频
|
|
|
|
[Category("录制视频"), Sort(1)]
|
|
public void 显示界面()
|
|
{
|
|
if (KUIRoot.Instance)
|
|
KUIRoot.Instance.gameObject.SetActive(true);
|
|
}
|
|
|
|
[Category("录制视频"), Sort(2)]
|
|
public void 隐藏界面()
|
|
{
|
|
if (KUIRoot.Instance)
|
|
{
|
|
UnityEngine.EventSystems.EventSystem.current.transform.parent = null;
|
|
KUIRoot.Instance.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public static bool BlockAd = false;
|
|
[Category("录制视频"), Sort(3)]
|
|
public void 屏蔽广告()
|
|
{
|
|
BlockAd = !BlockAd;
|
|
}
|
|
|
|
public static string AB_Version;
|
|
[Category("录制视频"), Sort(4)]
|
|
public void 版本1()
|
|
{
|
|
AB_Version = "1";
|
|
}
|
|
|
|
[Category("录制视频"), Sort(5)]
|
|
public void 版本2()
|
|
{
|
|
AB_Version = "2";
|
|
}
|
|
|
|
[Category("录制视频"), Sort(6)]
|
|
public void 战斗编辑()
|
|
{
|
|
BattleEditor.Show();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 挂机
|
|
|
|
[Category("挂机"), Sort(1)]
|
|
public bool 自动挂机
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
[Category("挂机"), Sort(2)]
|
|
public bool 自动体力
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
[Category("挂机"), Sort(3)]
|
|
public bool 自动武学
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
[Category("挂机"), Sort(4)]
|
|
public bool 自动三倍
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Category("挂机"), Sort(5)]
|
|
public bool 自动复活
|
|
{
|
|
get;
|
|
set;
|
|
} = true;
|
|
|
|
#endregion
|
|
|
|
[Category("技能"), Sort(1)]
|
|
public bool 技能开关
|
|
{
|
|
get;
|
|
set;
|
|
} = false;
|
|
|
|
[Category("技能"), Sort(1), NumberRange(1, 200)]
|
|
public int 技能ID
|
|
{
|
|
get;
|
|
set;
|
|
} = 1;
|
|
|
|
[Category("技能"), Sort(2)]
|
|
public void 学习技能()
|
|
{
|
|
if (MovesShop.Instance)
|
|
MovesShop.Instance.StudyMoves(技能ID, true);
|
|
}
|
|
|
|
[Category("查错"), Sort(1)]
|
|
public void 剧情查错()
|
|
{
|
|
var groupItems = ItemProxy.Instance.GetStaticItems<ItemStoryGroup>();
|
|
foreach (var groupItem in groupItems)
|
|
{
|
|
try
|
|
{
|
|
var group = new StoryGroup(groupItem);
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
Debug.Log(groupItem.id + " " + ex.Message);
|
|
}
|
|
}
|
|
}
|
|
|
|
[Category("查错"), Sort(2)]
|
|
public void 装备查错()
|
|
{
|
|
var props = ItemProxy.Instance.GetStaticItems<ItemProp>();
|
|
var equipments = ItemProxy.Instance.GetStaticItems<ItemEquipment>();
|
|
|
|
foreach (var item in props)
|
|
{
|
|
if (item.isWeaponOrEquipment)
|
|
{
|
|
var equipment = ItemProxy.Instance.GetStaticItem<ItemEquipment>(item.id);
|
|
if (equipment == null)
|
|
{
|
|
Debug.Log($"装备表缺少{item.id}");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
foreach (var item in equipments)
|
|
{
|
|
var prop = ItemProxy.Instance.GetStaticItem<ItemProp>(item.id);
|
|
if (prop == null)
|
|
{
|
|
Debug.Log($"道具表缺少{item.id}");
|
|
}
|
|
}
|
|
|
|
foreach (var item in equipments)
|
|
{
|
|
if (item.type == 0)
|
|
AssetProxy.Instance.InstantiateAsync(item.assets);
|
|
}
|
|
}
|
|
|
|
[Category("概率"), Sort(1), NumberRange(1, 200)]
|
|
public int 概率Id
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Category("概率"), Sort(2)]
|
|
public void 随机一万次()
|
|
{
|
|
int count = 0;
|
|
for (int i = 0; i < 10000; i++)
|
|
{
|
|
if (RandomProxy.Instance.GetRandomNotSave(概率Id))
|
|
{
|
|
count++;
|
|
}
|
|
}
|
|
Debug.Log(StringLoggingExtensions.Colored($"随机结果{count}/{10000} = {count * 0.01f}%", Color.green));
|
|
}
|
|
|
|
[Category("概率"), Sort(3), NumberRange(1, 9999999)]
|
|
public int 宝箱Id
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Category("概率"), Sort(3), NumberRange(0, 9999999)]
|
|
public int 额外权重
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Category("概率"), Sort(4)]
|
|
public void 随机宝箱()
|
|
{
|
|
var boxInfo = BoxProxy.Instance.GetBoxInfo(宝箱Id);
|
|
if (boxInfo != null)
|
|
{
|
|
System.Collections.Generic.Dictionary<int, Vector2Int> _itemDict = new System.Collections.Generic.Dictionary<int, Vector2Int>();
|
|
for (int i = 0; i < 10000; i++)
|
|
{
|
|
var item = boxInfo.GetRndItem(额外权重);
|
|
if (_itemDict.TryGetValue(item.id, out var itemInfo))
|
|
{
|
|
itemInfo.x += 1;
|
|
itemInfo.y += item.count;
|
|
_itemDict[item.id] = itemInfo;
|
|
}
|
|
else
|
|
{
|
|
_itemDict.Add(item.id, new Vector2Int(1, item.count));
|
|
}
|
|
}
|
|
|
|
string result = "随机宝箱:\n";
|
|
foreach (var item in _itemDict)
|
|
{
|
|
string name = "物品配置错误";
|
|
var prop = ItemProxy.Instance.GetStaticItem<ItemProp>(item.Key);
|
|
if (prop != null)
|
|
name = prop.name;
|
|
result += $"id:{item.Key} 名字:<color=#{Item.GetQualityColorString(prop.quality)}>{name}</color> 数量:{item.Value.y} 概率:{item.Value.x * 0.01f }% \n";
|
|
}
|
|
Debug.Log(result);
|
|
}
|
|
}
|
|
|
|
[Category("打印"), Sort(4)]
|
|
public void 打印属性()
|
|
{
|
|
PrintAttrbuites("growthAttributes", PlayerProxy.Instance.growthAttributes);
|
|
PrintAttrbuites("equipmentAttributes", PlayerProxy.Instance.equipmentAttributes);
|
|
PrintAttrbuites("kungfuAttributes", PlayerProxy.Instance.kungfuAttributes);
|
|
PrintAttrbuites("titleAttributes", PlayerProxy.Instance.titleAttributes);
|
|
PrintAttrbuites("beautyAttributes", PlayerProxy.Instance.beautyAttributes);
|
|
PrintAttrbuites("petAttributes", PlayerProxy.Instance.petAttributes);
|
|
}
|
|
|
|
private static void PrintAttrbuites(string name, CombatAttribute[] attributes)
|
|
{
|
|
var text = name + ":";
|
|
foreach (var item in attributes)
|
|
{
|
|
text += item.ToString() + ",";
|
|
}
|
|
Debug.Log(text);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 不要修改
|
|
/// </summary>
|
|
partial class KGMOptions : SROptions
|
|
{
|
|
public static readonly KGMOptions Instance = new KGMOptions();
|
|
/// <summary>
|
|
/// Initialize SRDebugger after the scene has loaded.
|
|
/// </summary>
|
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
|
public static void Init()
|
|
{
|
|
Current = Instance;
|
|
Current = Instance;
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif |