完善逻辑
This commit is contained in:
parent
476c37917a
commit
c756778eb4
@ -79,7 +79,7 @@ namespace QFramework
|
||||
});
|
||||
}
|
||||
|
||||
UIKit.OpenPanelAsync<UIImageSelectMap>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() =>
|
||||
UIKit.OpenPanelAsync<UIImageSelectMap>(uiData: data).ToAction().StartGlobal(() =>
|
||||
{
|
||||
|
||||
this.Finish();
|
||||
|
||||
@ -45,6 +45,7 @@ namespace QFramework.Example
|
||||
protected override void OnInit(IUIData uiData = null)
|
||||
{
|
||||
mData = uiData as UIImageSelectMapData ?? new UIImageSelectMapData();
|
||||
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuitHandler);
|
||||
// please add init code here
|
||||
loader = ResLoader.Allocate();
|
||||
}
|
||||
@ -52,15 +53,10 @@ namespace QFramework.Example
|
||||
protected override void OnOpen(IUIData uiData = null)
|
||||
{
|
||||
mData = uiData as UIImageSelectMapData ?? new UIImageSelectMapData();
|
||||
|
||||
LeftContent.RemoveAllChildren();
|
||||
RightContent.RemoveAllChildren();
|
||||
itemDatas.Clear();
|
||||
leftAndRightMap.Clear();
|
||||
if (mData.random)
|
||||
{
|
||||
Utility.Shuffle(mData.items);
|
||||
}
|
||||
foreach (var item in mData.items)
|
||||
{
|
||||
var leftObj = GameObject.Instantiate(LeftItem, LeftContent);
|
||||
@ -86,7 +82,10 @@ namespace QFramework.Example
|
||||
rightObj.OnPointerExitEvent(RightOnExit);
|
||||
rightObj.OnPointerClickEvent(RightOnClick);
|
||||
}
|
||||
|
||||
if (mData.random)
|
||||
{
|
||||
Utility.ShuffleChildObjects(LeftContent);
|
||||
}
|
||||
|
||||
loader.LoadAsync();
|
||||
|
||||
@ -94,6 +93,11 @@ namespace QFramework.Example
|
||||
|
||||
}
|
||||
|
||||
private void OnModuleQuitHandler(OnModuleQuit quit)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void RightOnClick(PointerEventData data)
|
||||
{
|
||||
Transform trans = data.pointerClick.transform;
|
||||
@ -142,13 +146,7 @@ namespace QFramework.Example
|
||||
{
|
||||
nameText.color = Color.green;
|
||||
isRight = true;
|
||||
if (Check())
|
||||
{
|
||||
if (string.IsNullOrEmpty(mData.finishedEvent))
|
||||
{
|
||||
StringEventSystem.Global.Send(mData.finishedEvent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -161,6 +159,15 @@ namespace QFramework.Example
|
||||
nameText.text = itemDatas[leftDragObj].name;
|
||||
leftAndRightMap.Add(enterRight, new RightDataItem() { rightObj = leftDragObj, isRight = isRight });
|
||||
leftDragObj.SetActive(false);
|
||||
|
||||
if (isRight && Check())
|
||||
{
|
||||
if (string.IsNullOrEmpty(mData.finishedEvent) == false)
|
||||
{
|
||||
StringEventSystem.Global.Send(mData.finishedEvent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
GameObject.Destroy(moveObj);
|
||||
moveObj = null;
|
||||
@ -176,7 +183,7 @@ namespace QFramework.Example
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return leftAndRightMap.Count == mData.items.Count;
|
||||
}
|
||||
|
||||
private void LeftOnDrag(PointerEventData data)
|
||||
@ -199,6 +206,7 @@ namespace QFramework.Example
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
TypeEventSystem.Global.UnRegister<OnModuleQuit>(OnModuleQuitHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ namespace QFramework.Example
|
||||
SceneManager.sceneLoaded += OnLoadFinished;
|
||||
});
|
||||
});
|
||||
if (string.IsNullOrEmpty(item.Icon)==false)
|
||||
if (string.IsNullOrEmpty(item.Icon) == false)
|
||||
{
|
||||
var icon = obj.transform.Find("Icon").GetComponent<Image>();
|
||||
var localImageUrl = Global.imagePath + item.Icon;
|
||||
@ -129,7 +129,7 @@ namespace QFramework.Example
|
||||
{
|
||||
var machin = StateMachineController.Instance;
|
||||
}
|
||||
UIKit.OpenPanelAsync<UIRightTop>().ToAction().StartGlobal(() =>
|
||||
UIKit.OpenPanelAsync<UIRightTop>(canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() =>
|
||||
{
|
||||
|
||||
TypeEventSystem.Global.Send<OnModuleStart>();
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<Enter>
|
||||
<Action type="Sequence">
|
||||
<Action type="ImageSelectMap"
|
||||
random="true"
|
||||
random="false"
|
||||
scoreName=""
|
||||
totalScore=""
|
||||
rightScore=""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user