first commit

This commit is contained in:
2026-02-09 20:10:14 +08:00
commit 47a5cff08b
2638 changed files with 322636 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using System.Collections.Generic;
using FairyGUI;
using UnityEngine;
using NBC;
using UIPanel = NBC.UIPanel;
namespace NBF
{
public partial class LoginPanel : UIPanel
{
private string serverUrl;
private string serverPassword;
protected override void OnInit()
{
this.AutoAddClick(OnClick);
}
protected override void OnShowed()
{
InputServer.Input.promptText = "请输入服务器地址";
InputPass.Input.promptText = "请输入服务器密码";
serverUrl = PlayerPrefs.GetString("serverUrl", string.Empty);
serverPassword = PlayerPrefs.GetString("serverPassword", string.Empty);
InputServer.Input.text = serverUrl;
InputPass.Input.text = serverPassword;
if (!string.IsNullOrEmpty(serverUrl) && !string.IsNullOrEmpty(serverPassword))
{
Connect();
}
}
private void OnClick(GComponent btn)
{
if (btn == BtnLogin)
{
if (!string.IsNullOrEmpty(InputPass.Input.text))
{
serverPassword = InputPass.Input.text;
}
if (!string.IsNullOrEmpty(InputServer.Input.text))
{
serverUrl = InputServer.Input.text;
}
Connect();
// Notices.Show("测试========----------的首发式地方");
// MessageBox.ShowMessage("啊撒旦立刻就了",(b =>
// {
// Log.Info($"b={b}");
// }));
}
}
private void Connect()
{
Net.Instance.SetServer(serverUrl, serverPassword);
PlayerPrefs.SetString("serverUrl", serverUrl);
PlayerPrefs.SetString("serverPassword", serverPassword);
Game.Instance.Tick((ret) =>
{
if (ret)
{
PlayerPanel.Show();
}
else
{
MessageBox.ShowMessage("无法连接服务器,请检查服务器信息\n格式192.168.0.120:9888", null);
}
});
}
}
}