更新bug
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using FairyGUI;
|
||||
using FGUI.Common_01;
|
||||
using FGUI.Setting_07;
|
||||
using IgnoreOPS;
|
||||
// using SGModule.ApplePay;
|
||||
@@ -22,7 +23,7 @@ namespace ChillConnect
|
||||
{
|
||||
uiName = UIConst.MenuUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
@@ -101,16 +102,56 @@ namespace ChillConnect
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private int _selectIndex = 0;
|
||||
private const int TotalItem = 8;
|
||||
private void UpdataAvatar(object obj = null)
|
||||
{
|
||||
// var head = ui.btn_head.head as btn_head;
|
||||
// var head = ui.btn_head.head as btn_head;
|
||||
|
||||
// GameHelper.SetSelfAvatar(head.load_avatar);
|
||||
// GameHelper.SetSelfAvatar(head.load_avatar);
|
||||
}
|
||||
private void UpdateItem(int index, GObject items)
|
||||
{
|
||||
Debug.Log($"updateItem============index =={index}");
|
||||
var currentIndex = index + 1;
|
||||
var head = items as btn_item_head;
|
||||
var imgHead = head.head as btn_head;
|
||||
|
||||
TextureHelper.SetAvatarToLoader(currentIndex, imgHead.load_avatar);
|
||||
head.head_select.selectedIndex = _selectIndex == currentIndex
|
||||
? btn_item_head.Head_select_select
|
||||
: btn_item_head.Head_select_none;
|
||||
|
||||
head.SetClick(() =>
|
||||
{
|
||||
_selectIndex = currentIndex;
|
||||
ui.list.numItems = TotalItem;
|
||||
|
||||
SetHeadPic();
|
||||
PreferencesDispatcher<int>.Instance.Dispatch(DataMsg.playerAvatarId);
|
||||
});
|
||||
}
|
||||
private void SetAvatar()
|
||||
{
|
||||
if (_selectIndex != -1 && _selectIndex != DataMgr.PlayerAvatarId.Value)
|
||||
{
|
||||
DataMgr.PlayerAvatarId.Value = _selectIndex;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetHeadPic()
|
||||
{
|
||||
SetAvatar();
|
||||
|
||||
// var head = ui.head as btn_head;
|
||||
// if (head == null) return;
|
||||
// TextureHelper.SetAvatarToLoader(_selectIndex, head.load_avatar);
|
||||
}
|
||||
private void InitView()
|
||||
{
|
||||
_selectIndex= DataMgr.PlayerAvatarId.Value;
|
||||
ui.list.itemRenderer = UpdateItem;
|
||||
ui.list.numItems = TotalItem;
|
||||
// var namStr = GameHelper.GetUserName();
|
||||
// ui.edit_name.input.text = namStr;
|
||||
// ui.edit_name.btn_amend.SetClick(SaveName);
|
||||
@@ -191,7 +232,8 @@ namespace ChillConnect
|
||||
// // });
|
||||
// CtrlCloseUI();
|
||||
// });
|
||||
|
||||
ui.btn_close.SetClick(CtrlCloseUI);
|
||||
ui.btn_select.SetClick(CtrlCloseUI);
|
||||
|
||||
}
|
||||
|
||||
@@ -199,12 +241,12 @@ namespace ChillConnect
|
||||
private void SetVersion()
|
||||
{
|
||||
// Debug.Log($"SetVersion====== {Application.version}");
|
||||
// ui.text_version.SetVar("count", Application.version).FlushVars();
|
||||
// ui.text_version.SetVar("count", Application.version).FlushVars();
|
||||
}
|
||||
|
||||
private void SetUID()
|
||||
{
|
||||
// ui.text_uid.SetVar("UID", GameHelper.GetLoginModel().Uid.ToString()).FlushVars();
|
||||
// ui.text_uid.SetVar("UID", GameHelper.GetLoginModel().Uid.ToString()).FlushVars();
|
||||
}
|
||||
|
||||
public override void OnSwitchLanguage()
|
||||
|
||||
Reference in New Issue
Block a user