686 lines
19 KiB
C#
Raw Normal View History

2025-05-18 01:04:31 +08:00
// ***********************************************************************
// 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