提交修改
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
using FairyGUI.Utils;
|
||||
|
||||
namespace FairyGUI
|
||||
{
|
||||
public class ChangePageAction : ControllerAction
|
||||
{
|
||||
public string objectId;
|
||||
public string controllerName;
|
||||
public string targetPage;
|
||||
|
||||
public ChangePageAction()
|
||||
{
|
||||
}
|
||||
|
||||
override protected void Enter(Controller controller)
|
||||
{
|
||||
if (string.IsNullOrEmpty(controllerName))
|
||||
return;
|
||||
|
||||
GComponent gcom;
|
||||
if (!string.IsNullOrEmpty(objectId))
|
||||
gcom = controller.parent.GetChildById(objectId) as GComponent;
|
||||
else
|
||||
gcom = controller.parent;
|
||||
if (gcom != null)
|
||||
{
|
||||
Controller cc = gcom.GetController(controllerName);
|
||||
if (cc != null && cc != controller && !cc.changing)
|
||||
{
|
||||
if (this.targetPage == "~1")
|
||||
{
|
||||
if (controller.selectedIndex < cc.pageCount)
|
||||
cc.selectedIndex = controller.selectedIndex;
|
||||
}
|
||||
else if (this.targetPage == "~2")
|
||||
cc.selectedPage = controller.selectedPage;
|
||||
else
|
||||
cc.selectedPageId = this.targetPage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override public void Setup(ByteBuffer buffer)
|
||||
{
|
||||
base.Setup(buffer);
|
||||
|
||||
objectId = buffer.ReadS();
|
||||
controllerName = buffer.ReadS();
|
||||
targetPage = buffer.ReadS();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 625a0a9a670984b47a4b170a801c850e
|
||||
timeCreated: 1535374214
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,68 +0,0 @@
|
||||
using System;
|
||||
using FairyGUI.Utils;
|
||||
|
||||
namespace FairyGUI
|
||||
{
|
||||
public class ControllerAction
|
||||
{
|
||||
public enum ActionType
|
||||
{
|
||||
PlayTransition,
|
||||
ChangePage
|
||||
}
|
||||
|
||||
public string[] fromPage;
|
||||
public string[] toPage;
|
||||
|
||||
public static ControllerAction CreateAction(ActionType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ActionType.PlayTransition:
|
||||
return new PlayTransitionAction();
|
||||
|
||||
case ActionType.ChangePage:
|
||||
return new ChangePageAction();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ControllerAction()
|
||||
{
|
||||
}
|
||||
|
||||
public void Run(Controller controller, string prevPage, string curPage)
|
||||
{
|
||||
if ((fromPage == null || fromPage.Length == 0 || Array.IndexOf(fromPage, prevPage) != -1)
|
||||
&& (toPage == null || toPage.Length == 0 || Array.IndexOf(toPage, curPage) != -1))
|
||||
Enter(controller);
|
||||
else
|
||||
Leave(controller);
|
||||
}
|
||||
|
||||
virtual protected void Enter(Controller controller)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual protected void Leave(Controller controller)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual public void Setup(ByteBuffer buffer)
|
||||
{
|
||||
int cnt;
|
||||
|
||||
cnt = buffer.ReadShort();
|
||||
fromPage = new string[cnt];
|
||||
for (int i = 0; i < cnt; i++)
|
||||
fromPage[i] = buffer.ReadS();
|
||||
|
||||
cnt = buffer.ReadShort();
|
||||
toPage = new string[cnt];
|
||||
for (int i = 0; i < cnt; i++)
|
||||
toPage[i] = buffer.ReadS();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6fb1eb3d57827b4bb09eddfa5c76137
|
||||
timeCreated: 1535374215
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,52 +0,0 @@
|
||||
using FairyGUI.Utils;
|
||||
|
||||
namespace FairyGUI
|
||||
{
|
||||
public class PlayTransitionAction : ControllerAction
|
||||
{
|
||||
public string transitionName;
|
||||
public int playTimes;
|
||||
public float delay;
|
||||
public bool stopOnExit;
|
||||
|
||||
private Transition _currentTransition;
|
||||
|
||||
public PlayTransitionAction()
|
||||
{
|
||||
playTimes = 1;
|
||||
delay = 0;
|
||||
}
|
||||
|
||||
override protected void Enter(Controller controller)
|
||||
{
|
||||
Transition trans = controller.parent.GetTransition(transitionName);
|
||||
if (trans != null)
|
||||
{
|
||||
if (_currentTransition != null && _currentTransition.playing)
|
||||
trans.ChangePlayTimes(playTimes);
|
||||
else
|
||||
trans.Play(playTimes, delay, null);
|
||||
_currentTransition = trans;
|
||||
}
|
||||
}
|
||||
|
||||
override protected void Leave(Controller controller)
|
||||
{
|
||||
if (stopOnExit && _currentTransition != null)
|
||||
{
|
||||
_currentTransition.Stop();
|
||||
_currentTransition = null;
|
||||
}
|
||||
}
|
||||
|
||||
override public void Setup(ByteBuffer buffer)
|
||||
{
|
||||
base.Setup(buffer);
|
||||
|
||||
transitionName = buffer.ReadS();
|
||||
playTimes = buffer.ReadInt();
|
||||
delay = buffer.ReadFloat();
|
||||
stopOnExit = buffer.ReadBool();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eac7f8de0d09f17439fb3c8e4a06090e
|
||||
timeCreated: 1535374215
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user