首次提交

This commit is contained in:
2026-07-13 18:14:23 +08:00
commit 20d09e4ebb
5293 changed files with 621708 additions and 0 deletions
@@ -0,0 +1,19 @@
namespace ScrewsMaster
{
public class ProfileCtrl : BaseCtrl
{
public static ProfileCtrl Instance { get; private set; }
private ProfileModel model;
protected override void OnInit()
{
Instance = this;
}
protected override void OnDispose()
{
Instance = null;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 970255a4b82f460d9def10244e6f0065
timeCreated: 1676361371
@@ -0,0 +1,15 @@
namespace ScrewsMaster
{
public class ProfileModel : BaseModel
{
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3edb59af67134ff28c25fcc70c05c652
timeCreated: 1676361371
@@ -0,0 +1,124 @@
namespace ScrewsMaster
{
using FairyGUI;
using FGUI.G006_menu;
public class ProfileUI : BaseUI
{
private ProfileUICtrl ctrl;
private ProfileModel model;
private FGUI.G006_menu.com_edit ui;
private LoginModel loginModel;
private int selectIndex = -1;
private int avatarTotal;
public ProfileUI(ProfileUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.ProfileUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "G006_menu";
uiInfo.assetName = "com_edit";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
protected override void OnInit()
{
model = moduleManager.GetModel(ModelConst.ProfileModel) as ProfileModel;
loginModel = moduleManager.GetModel(ModelConst.LoginModel) as LoginModel;
}
protected override void OnClose()
{
WebviewManager.Instance.SetDarkThough(true);
CommonHelper.FadeOut(ui);
}
protected override void OnBind()
{
ui = baseUI as FGUI.G006_menu.com_edit;
}
protected override void OnOpenBefore(object args)
{
WebviewManager.Instance.SetDarkThough(false);
InitData();
InitView();
}
protected override void OnOpen(object args)
{
CommonHelper.FadeIn(ui);
}
private void InitData()
{
selectIndex = PreferencesMgr.Instance.PlayerAvatarId;
avatarTotal = 12;
}
private void InitView()
{
ui.closeButton.onClick.Set(OnCloseView);
GameHelper.SetName(ui.textp_name);
ui.btn_ok.onClick.Set(OnClickOK);
ui.list_avatar.itemRenderer = ItemRenderer;
ui.list_avatar.numItems = avatarTotal;
}
private void OnClickOK()
{
var name = ui.textp_name.text;
OnCloseView();
if (selectIndex != -1)
{
PreferencesMgr.Instance.PlayerAvatarId = selectIndex;
}
if (string.IsNullOrEmpty(name) || name.IsNullOrWhiteSpace())
{
GameHelper.ShowTips("The input cannot be null", true);
return;
}
if (!name.Equals(PreferencesMgr.Instance.PlayerName))
{
PreferencesMgr.Instance.PlayerName = name;
}
}
private void ItemRenderer(int index, GObject item)
{
var btnImg = item as btn_img;
var currentIndex = index + 1;
TextureHelper.SetAvatarToLoader(currentIndex, btnImg.head_loader.GetChild("loader_avatar") as GLoader);
btnImg.cont_select.selectedIndex = selectIndex == currentIndex
? btn_img.Select_select
: btn_img.Select_none;
btnImg.SetClick(() =>
{
selectIndex = currentIndex;
ui.list_avatar.numItems = avatarTotal;
});
}
private void OnCloseView()
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ProfileUI_Close);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 41f063f214894f10a07d3e0716925cce
timeCreated: 1676361371
@@ -0,0 +1,60 @@
namespace ScrewsMaster
{
public class ProfileUICtrl : BaseUICtrl
{
private ProfileUI ui;
private ProfileModel model;
private uint openUIMsg = UICtrlMsg.ProfileUI_Open;
private uint closeUIMsg = UICtrlMsg.ProfileUI_Close;
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new ProfileUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui is { isClose: false })
{
ui.Close();
}
ui = null;
}
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
}
protected override void AddListener()
{
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
}
protected override void RemoveListener()
{
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a7882350acc64942a9f041db31da1c52
timeCreated: 1676361371