58 lines
1.2 KiB
C#
58 lines
1.2 KiB
C#
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;
|
|
}
|
|
}
|