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