private void Assignations() { _noDestroy = FindObjectOfType <NoDestroy>(); _control = FindObjectOfType <FlightControl>(); _sound = GetComponent <SoundManager>(); _transition = FindObjectOfType <TransitionControl>(); }
public override void Initialize(UIType UIName) { base.Initialize(UIName); UnityTool.M_Debug("过渡场景游戏UI"); m_userModel = new TransitionModel(UIName); m_userView = new TransitionView(m_userModel, m_RootUI); m_userControl = new TransitionControl(m_userModel, m_userView); }
private void Awake() { if (transitionManager == null) { transitionManager = this; } else { Destroy(gameObject); } }
protected virtual void BuildControls() { _transitionControl = new TransitionControl(); _transitionControl.Dock = DockStyle.Fill; _transitionControl.Location = new Point(0, 0); _transitionControl.Name = "Transition"; _transitionControl.Size = ClientSize; _transitionControl.TabIndex = 0; _transitionControl.Visible = false; Controls.Add(_transitionControl); }
// ================ Func : Default ================ // private void Awake() { if (instance == null) { instance = this; // InitTransition(); } else { Destroy(this.gameObject); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); // TransitionControl control = (TransitionControl)target; // if (GUILayout.Button("Door_Open")) { control.Door_Open(); } if (GUILayout.Button("Door_Close")) { control.Door_Close(); } }
// Use this for initialization void Start() { tc = GetComponent <TransitionControl>(); }
public bool DelTransition(TransitionControl con) { if (this.WorkflowProcessCurrent.Transitions.Remove(con.Transition)) { UserControls.Remove(con.Id); canvas.Children.Remove(con); if (con.Transition.FromNode != null) { if (con.Transition.FromNode is Activity) { ((Activity)con.Transition.FromNode).LeavingTransition = null; } else if (con.Transition.FromNode is Synchronizer) { ((Synchronizer)con.Transition.FromNode).LeavingTransitions.Remove(con.Transition); } } if (con.Transition.ToNode != null) { if (con.Transition.ToNode is Activity) { ((Activity)con.Transition.ToNode).EnteringTransition = null; } else if (con.Transition.ToNode is Synchronizer) { ((Synchronizer)con.Transition.ToNode).EnteringTransitions.Remove(con.Transition); } } return true; } return false; }
public void DelActivity(ActivityControl con) { if (this.WorkflowProcessCurrent.Activities.Remove(con.Activity)) { UserControls.Remove(con.Id); canvas.Children.Remove(con); if (con.Activity.EnteringTransition != null) { con.Activity.EnteringTransition.ToNode = null; } if (con.Activity.LeavingTransition != null) { con.Activity.LeavingTransition.FromNode = null; } currentTransitionControl = null; IsTransition = false; } }
//添加连接线 private void TransitionButtonDown(object sender, MouseButtonEventArgs e) { if (mouseEnterNode != null) { if (IsTransition == false) { //只能存在一个输出口 if (mouseEnterNode.Node is Activity && ((Activity)mouseEnterNode.Node).LeavingTransition != null) { Debug.WriteLine("Activity只能存在一个输出口!"); return; } Debug.WriteLine("增加TransitionControl"); currentTransitionControl = new TransitionControl(this, null, false); currentTransitionControl.InitEdge(); currentTransitionControl.Transition.FromNode = mouseEnterNode.Node; if (mouseEnterNode.Node is Synchronizer) { ((Synchronizer)mouseEnterNode.Node).LeavingTransitions.Add(currentTransitionControl.Transition); } else if (mouseEnterNode.Node is Activity) { ((Activity)mouseEnterNode.Node).LeavingTransition = currentTransitionControl.Transition; } mouseEnterNode = null; Point p = e.GetPosition(canvas); currentTransitionControl.SetTransitionPosition(p, null, p); if (!canvas.Children.Contains(currentTransitionControl)) { //设置位置 canvas.Children.Add(currentTransitionControl); UserControls.Add(currentTransitionControl.Id, currentTransitionControl); this.WorkflowProcessCurrent.Transitions.Add(currentTransitionControl.Transition); } IsTransition = true; return; } } if (IsTransition) { if (mouseEnterNode != null) { //判断是否配对连接 if (currentTransitionControl.Transition.FromNode is Activity && !(mouseEnterNode.Node is Synchronizer)) { //当源节点为Activity,目标节点必须是Synchronizer;否则退出 Debug.WriteLine("配对失败!当源节点为Activity,目标节点必须是Synchronizer;"); return; } else if(currentTransitionControl.Transition.FromNode is Synchronizer) { //当源节点为Synchronizer,目标节点必须是Activity,并且Activity没有输入项;否则退出 if (!(mouseEnterNode.Node is Activity) || ((Activity)mouseEnterNode.Node).EnteringTransition != null) { Debug.WriteLine("配对失败!当源节点为Synchronizer,目标节点必须是Activity,并且Activity没有输入项"); return; } } currentTransitionControl.Transition.ToNode = mouseEnterNode.Node; if (mouseEnterNode.Node is Synchronizer) { ((Synchronizer)mouseEnterNode.Node).EnteringTransitions.Add(currentTransitionControl.Transition); } else if (mouseEnterNode.Node is Activity) { ((Activity)mouseEnterNode.Node).EnteringTransition = currentTransitionControl.Transition; } mouseEnterNode = null; currentTransitionControl.SavePoint(); currentTransitionControl.LoadEdge(); this.AddHandle(currentTransitionControl); currentTransitionControl = null; IsTransition = false; } else { Point p = e.GetPosition(canvas); currentTransitionControl.AddLinePoint(p); } } }
/// <summary>取消</summary> private void EscapeControl() { //取消绘制循环 if (IsLoop) { if (DelLoop(currentLoopControl)) { currentLoopControl = null; IsLoop = false; } return; } //取消绘制流程转移 if (IsTransition) { if (DelTransition(currentTransitionControl)) { currentTransitionControl = null; IsTransition = false; } return; } //取消选择 ClearSelection(); }