增加时间GM工具

main
谢晓鑫 2024-01-11 18:37:42 +08:00
parent 50ed2b6656
commit e9eb450514
3 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,57 @@
using System;
using Newtonsoft.Json;
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
public class GMPartTimePass : GMPart
{
CommonResult result;
string timePass;
public override string GetName()
{
return "时间穿越";
}
public override void Init()
{
}
public override void OnTabGUI()
{
timePass = EditorGUILayout.TextField("穿越时间(秒):", timePass);
}
public override void OnOKGUI()
{
EditorGUILayout.LabelField(result.message);
}
public override string GetURL(string token, string ip, string actor)
{
return $"http://{ip}/time_pass?gm_token={token}&time={timePass}";
}
public override uint DoJsonDeserialize(string json, out string message)
{
uint code = 0;
try
{
result = JsonConvert.DeserializeObject<CommonResult>(json);
message = result.message;
code = result.code;
}
catch
{
Debug.LogError("json error, json=" + json);
message = "json error, json=" + json;
code = 1000;
}
return code;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ed3b6e9239a5b4ba79d950531217db6c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -18,6 +18,7 @@ public class GMWindow : EditorWindow, Gameplay.Net.IAppConfigHandler
CharacterLikely,
CharacterSkill,
SendMail,
TimePass,
Max,
}
@ -66,6 +67,7 @@ public class GMWindow : EditorWindow, Gameplay.Net.IAppConfigHandler
parts[(int)TabType.CharacterLikely] = new GMPartCharacterLikely();
parts[(int)TabType.CharacterSkill] = new GMPartCharacterSkillLevel();
parts[(int)TabType.SendMail] = new GMPartSendMail();
parts[(int)TabType.TimePass] = new GMPartTimePass();
ac = new Gameplay.Net.AppConfig();
ac.Init();