//設定索引內容 public void SetIndexContent(int count) { indexArray = new int[count]; indexContents = new string[count]; if (foldoutState == null) { foldoutState = new bool[0]; } bool[] _foldoutState = new bool[count]; //設定暫時變數, 避免直接new新陣列導致原本變數狀態遭到破壞 PassAnimation[] _beforeEvents = new PassAnimation[count]; //同上 UnityEvent[] _afterEvents = new UnityEvent[count]; //同上 for (byte i = 0; i < count; i++) { indexArray[i] = i + 1; indexContents[i] = "State " + (i + 1).ToString(); if (foldoutState.Length > i) { _foldoutState[i] = _foldoutState[i] = foldoutState[i]; } if (a_target.eventFlowFactory_before.Length > i) { _beforeEvents[i] = a_target.eventFlowFactory_before[i]; } if (a_target.eventFlowFactory_after.Length > i) { _afterEvents[i] = a_target.eventFlowFactory_after[i]; } } foldoutState = _foldoutState; a_target.eventFlowFactory_before = _beforeEvents; a_target.eventFlowFactory_after = _afterEvents; }
private void _viewModel_OnAnimation(object sender, UserRecommendationsViewModel.AnimationEventArgs e) { Deployment.Current.Dispatcher.BeginInvoke(() => { switch (e.AnimationName) { case "Like": LikeAnimation.Begin(); break; case "Pass": PassAnimation.Begin(); break; } }); }