UIFirstSignIn:集成创建账号
This commit is contained in:
parent
b8c2d5388d
commit
f182c9bc1b
@ -1517,6 +1517,7 @@ GameObject:
|
||||
- component: {fileID: 3502319727893676587}
|
||||
- component: {fileID: 2535539976810679783}
|
||||
- component: {fileID: 3065960092424328789}
|
||||
- component: {fileID: 2926006177409033083}
|
||||
m_Layer: 0
|
||||
m_Name: BtnStart
|
||||
m_TagString: Untagged
|
||||
@ -1626,6 +1627,28 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &2926006177409033083
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3347641715054964723}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8759edc0b8b4b3d4aa8ffef2482e17ee, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
UIName:
|
||||
keys:
|
||||
- UnityEngine.RectTransform
|
||||
- UnityEngine.CanvasRenderer
|
||||
- UnityEngine.UI.Image
|
||||
- UnityEngine.UI.Button
|
||||
- UINode
|
||||
values: 0000000100
|
||||
depObjs: []
|
||||
activeType: 0
|
||||
--- !u!1 &3567915113891765122
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2374,6 +2397,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 478eb3ad23914de42a93c133f43a6d95, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
curHeadSprite: {fileID: 0}
|
||||
curName:
|
||||
--- !u!1 &6299393793213910496
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -40,6 +40,7 @@ end
|
||||
|
||||
function UIFirstSignInView:Init()
|
||||
LogWarning("UIFirstSignInView:init")
|
||||
self.signComp = self.transform:GetComponent("UIFirstSignIn.UIFirstSignIn")
|
||||
--self:RollName()
|
||||
end
|
||||
|
||||
@ -50,25 +51,17 @@ end
|
||||
|
||||
function UIFirstSignInView:RemoveEventListener()
|
||||
ManagerContainer.LuaEventMgr:Unregister(self.uiData.name)
|
||||
|
||||
end
|
||||
|
||||
function UIFirstSignInView:AddUIEventListener()
|
||||
self.uiBase:AddButtonEventListener(self.btnBack.button, self, self.OnClickBtnBack)
|
||||
--self.uiBase:AddButtonEventListener(self.btnRollName.button, self, self.OnClickBtnRollName)
|
||||
|
||||
self.uiBase:AddButtonEventListener(self.btnStart.button, self, self.OnBtnStart)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function UIFirstSignInView:OnHide()
|
||||
|
||||
end
|
||||
|
||||
function UIFirstSignInView:OnShow(data)
|
||||
self.controller:SetData(data)
|
||||
|
||||
end
|
||||
|
||||
function UIFirstSignInView:OnClose()
|
||||
@ -78,27 +71,17 @@ function UIFirstSignInView:OnDispose()
|
||||
self.controller:OnDispose()
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--region 按钮绑定
|
||||
--页面关闭按钮
|
||||
function UIFirstSignInView:OnClickBtnBack()
|
||||
self:UIClose();
|
||||
end
|
||||
|
||||
|
||||
|
||||
function UIFirstSignInView:OnClickBtnStart()
|
||||
LogWarning("点击进入游戏按钮")
|
||||
function UIFirstSignInView:OnBtnStart()
|
||||
local headId = self.signComp:GetHeadId()
|
||||
local nickname = self.signComp:GetNickname()
|
||||
LogError("UIFirstSignInView: OnBtnStart headId="..headId..", nickname="..nickname)
|
||||
self.controller:CreateRole(headId, nickName)
|
||||
end
|
||||
|
||||
--endregion 按钮绑定
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--[[--随机名称
|
||||
function UIFirstSignInView:OnClickBtnRollName()
|
||||
self:RollName()
|
||||
@ -110,10 +93,5 @@ end
|
||||
]]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return UIFirstSignInView
|
||||
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
---@field public gameObject UnityEngine.GameObject
|
||||
---@field public button UnityEngine.UI.Button
|
||||
|
||||
---@class UIFirstSignIn__Generate_btnStart
|
||||
---@field public gameObject UnityEngine.GameObject
|
||||
---@field public button UnityEngine.UI.Button
|
||||
|
||||
---@class UIFirstSignIn__Generate_content
|
||||
---@field public gameObject UnityEngine.GameObject
|
||||
---@field public rectTransform UnityEngine.RectTransform
|
||||
@ -10,6 +14,7 @@
|
||||
---@field private gameObject UnityEngine.GameObject
|
||||
---@field private transform UnityEngine.Transform
|
||||
---@field private content UIFirstSignIn__Generate_content
|
||||
---@field private btnStart UIFirstSignIn__Generate_btnStart
|
||||
---@field private btnBack UIFirstSignIn__Generate_btnBack
|
||||
local UIFirstSignInView = class("UIFirstSignInView", require("UIViewBase"))
|
||||
|
||||
@ -32,6 +37,7 @@ function UIFirstSignInView:InitGenerate(Root, data)
|
||||
|
||||
self:InitGenerate__1(Root,data)
|
||||
self:InitGenerate__2(Root,data)
|
||||
self:InitGenerate__3(Root,data)
|
||||
|
||||
|
||||
end
|
||||
@ -52,6 +58,20 @@ end
|
||||
|
||||
---@private
|
||||
function UIFirstSignInView:InitGenerate__2(Root, data)
|
||||
--[[
|
||||
PageSlider/Scroll View/Viewport/Content/Page_4/P4Content/BtnStart
|
||||
--]]
|
||||
local tmp = Root:Find("PageSlider/Scroll View/Viewport/Content/Page_4/P4Content/BtnStart").gameObject
|
||||
if tolua.getpeer(tmp) == nil then
|
||||
tolua.setpeer(tmp, {})
|
||||
end
|
||||
self.btnStart = tmp
|
||||
|
||||
tmp.button = tmp:GetComponent(Enum.TypeInfo.Button)
|
||||
end
|
||||
|
||||
---@private
|
||||
function UIFirstSignInView:InitGenerate__3(Root, data)
|
||||
--[[
|
||||
BtnBack
|
||||
--]]
|
||||
@ -70,6 +90,10 @@ function UIFirstSignInView:GenerateDestroy()
|
||||
tolua.setpeer(self.content, nil)
|
||||
end
|
||||
self.content = nil
|
||||
if tolua.getpeer(self.btnStart) ~= nil then
|
||||
tolua.setpeer(self.btnStart, nil)
|
||||
end
|
||||
self.btnStart = nil
|
||||
if tolua.getpeer(self.btnBack) ~= nil then
|
||||
tolua.setpeer(self.btnBack, nil)
|
||||
end
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using LuaInterface;
|
||||
using MikuLuaProfiler;
|
||||
using SuperScrollView;
|
||||
using TMPro;
|
||||
@ -25,6 +27,7 @@ namespace UIFirstSignIn
|
||||
List<PageContent> Pages;
|
||||
|
||||
PageContent curpage;
|
||||
private int currHeadId = 0;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@ -44,7 +47,7 @@ namespace UIFirstSignIn
|
||||
void Start()
|
||||
{
|
||||
btnRollName.onClick.AddListener(() => { RollName(); });
|
||||
btnStart.onClick.AddListener(() => { StartGame(); });
|
||||
//btnStart.onClick.AddListener(() => { StartGame(); });
|
||||
inputName.onEndEdit.AddListener((str) => { curName = str; });
|
||||
|
||||
InitPage();
|
||||
@ -85,6 +88,7 @@ namespace UIFirstSignIn
|
||||
#endregion 获取页面,添加页面切换事件
|
||||
}
|
||||
//滑动锁,防止文字加载时的滑动操作
|
||||
[NoToLua]
|
||||
public void ScrollLock()
|
||||
{
|
||||
if (curpage != null)
|
||||
@ -103,6 +107,35 @@ namespace UIFirstSignIn
|
||||
#region 头像列表
|
||||
int headcount = 40; //头像总数
|
||||
|
||||
private int ExtractLastInteger(string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input))
|
||||
return 0;
|
||||
|
||||
// 匹配整数(包括负数)
|
||||
MatchCollection matches = Regex.Matches(input, @"-?\d+");
|
||||
|
||||
if (matches.Count > 0)
|
||||
{
|
||||
string lastNumber = matches[matches.Count - 1].Value;
|
||||
if (int.TryParse(lastNumber, out int result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return 0; // 或者根据需求返回默认值
|
||||
}
|
||||
public int GetHeadId()
|
||||
{
|
||||
var name = curHeadSprite.name;
|
||||
return ExtractLastInteger(name);
|
||||
}
|
||||
|
||||
public string GetNickname()
|
||||
{
|
||||
return inputName.text;
|
||||
}
|
||||
|
||||
void InitHeadListViw()
|
||||
{
|
||||
|
||||
@ -322,7 +322,8 @@ public static class CustomSettings
|
||||
_GT (typeof (UiLoopAutoMove)),
|
||||
_GT (typeof(GUIUtility)),
|
||||
_GT (typeof(UnityEngineUtils)),
|
||||
_GT(typeof(MyDanmuPlayer))
|
||||
_GT(typeof(MyDanmuPlayer)),
|
||||
_GT(typeof(UIFirstSignIn.UIFirstSignIn))
|
||||
};
|
||||
|
||||
public static List<Type> dynamicList = new List<Type>() {
|
||||
|
||||
@ -440,6 +440,9 @@ public static class LuaBinder
|
||||
Wenting_Lebian_QueryUpdateErrorCodeWrap.Register(L);
|
||||
L.EndModule();
|
||||
L.EndModule();
|
||||
L.BeginModule("UIFirstSignIn");
|
||||
UIFirstSignIn_UIFirstSignInWrap.Register(L);
|
||||
L.EndModule();
|
||||
L.BeginModule("UIBase");
|
||||
L.RegFunction("ButtonListener", UIBase_ButtonListener);
|
||||
L.RegFunction("ButtonListenerWithParam", UIBase_ButtonListenerWithParam);
|
||||
|
||||
@ -0,0 +1,69 @@
|
||||
//this source code was auto-generated by tolua#, do not modify it
|
||||
using System;
|
||||
using LuaInterface;
|
||||
|
||||
public class UIFirstSignIn_UIFirstSignInWrap
|
||||
{
|
||||
public static void Register(LuaState L)
|
||||
{
|
||||
L.BeginClass(typeof(UIFirstSignIn.UIFirstSignIn), typeof(UnityEngine.MonoBehaviour));
|
||||
L.RegFunction("GetHeadId", GetHeadId);
|
||||
L.RegFunction("GetNickname", GetNickname);
|
||||
L.RegFunction("__eq", op_Equality);
|
||||
L.RegFunction("__tostring", ToLua.op_ToString);
|
||||
L.EndClass();
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int GetHeadId(IntPtr L)
|
||||
{
|
||||
try
|
||||
{
|
||||
ToLua.CheckArgsCount(L, 1);
|
||||
UIFirstSignIn.UIFirstSignIn obj = (UIFirstSignIn.UIFirstSignIn)ToLua.CheckObject<UIFirstSignIn.UIFirstSignIn>(L, 1);
|
||||
int o = obj.GetHeadId();
|
||||
LuaDLL.lua_pushinteger(L, o);
|
||||
return 1;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return LuaDLL.toluaL_exception(L, e);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int GetNickname(IntPtr L)
|
||||
{
|
||||
try
|
||||
{
|
||||
ToLua.CheckArgsCount(L, 1);
|
||||
UIFirstSignIn.UIFirstSignIn obj = (UIFirstSignIn.UIFirstSignIn)ToLua.CheckObject<UIFirstSignIn.UIFirstSignIn>(L, 1);
|
||||
string o = obj.GetNickname();
|
||||
LuaDLL.lua_pushstring(L, o);
|
||||
return 1;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return LuaDLL.toluaL_exception(L, e);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int op_Equality(IntPtr L)
|
||||
{
|
||||
try
|
||||
{
|
||||
ToLua.CheckArgsCount(L, 2);
|
||||
UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1);
|
||||
UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2);
|
||||
bool o = arg0 == arg1;
|
||||
LuaDLL.lua_pushboolean(L, o);
|
||||
return 1;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return LuaDLL.toluaL_exception(L, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: defcdd724b1fa6b449a6defad521bef3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user