/// <summary> /// Initializes this instance. /// </summary> public void Initialize(CharacterSelectUI charSelectUI, UIScrollItem scrollItem, Character character, bool isUsed, bool isOwned, float ownedCharRotSpeed, float normalCharScale, float focusCharScale, float focusAnimTime, Vector3 focusPos, NewCharWinAnimator newCharWinAnim, Animator newCharAnimReference) { // Store references to character select classes m_charSelectUI = charSelectUI; m_scrollItem = scrollItem; m_character = character; SetUsed(isUsed); SetOwned(isOwned); SetOwnedCharRotSpeed(ownedCharRotSpeed); SetCharScale(normalCharScale, focusCharScale); SetFocusPos(focusPos); SetFocusAnimTime(focusAnimTime); m_newCharWinAnim = newCharWinAnim; // Store reference to animator to follow for new/unused characters m_newCharAnimReference = newCharAnimReference; // Store the character's starting transform properties m_originalRot = m_character.transform.localEulerAngles; m_originalPosZ = m_character.transform.localPosition.z; // Set the initialized flag m_isInitialized = true; }
/// <summary> /// Initializes this instance. /// </summary> /// <param name="moveDir">Move direction of this confetti.</param> /// <param name="speed">Speed at which this confetti moves.</param> /// <param name="targetPosY">Target vertical level to move to.</param> /// <param name="rotation">The confetti model's rotation.</param> /// <param name="newCharAnim">New character anim instance handling this confetti.</param> /// <param name="arrayIndex">Index of this confetti in the array of confetti objects.</param> public void Initialize(Vector3 moveDir, float speed, float targetPosY, Vector3 rotation, NewCharWinAnimator newCharAnim, int arrayIndex) { m_moveDir = moveDir; m_speed = speed; m_targetPosY = targetPosY; m_confettiRoot.eulerAngles = rotation; m_newCharAnim = newCharAnim; m_arrayIndex = arrayIndex; // Set the initialized flag m_isInitialized = true; }
/// <summary> /// Initializes this instance. /// </summary> public void Initialize(GameSceneMaster sceneMaster, NewCharWinAnimator newCharWinAnim, Vector3 initialCharacterRotation, CharacterResource characterResource, System.EventHandler <System.EventArgs> playCharacterDelegate, System.EventHandler <System.EventArgs> buyCharacterDelegate, System.EventHandler <System.EventArgs> charSelectShareDelegate, System.Action <int> ownedCharCountChangedDelegate, System.EventHandler <System.EventArgs> pressSoundDelegate, System.EventHandler <System.EventArgs> releaseSoundDelegate) { m_newCharWinAnim = newCharWinAnim; // Set the initial rotation for characters in character select m_initialRotation = initialCharacterRotation; // Initialize buttons m_playCharacterBtn.Initialize(playCharacterDelegate, UIButton.TriggerType.ON_RELEASE); m_buyCharacterBtn.Initialize(buyCharacterDelegate, UIButton.TriggerType.ON_RELEASE); m_charSelectShareBtn.Initialize(charSelectShareDelegate, UIButton.TriggerType.ON_RELEASE); // Set button sounds m_playCharacterBtn.AddSoundDelegates(pressSoundDelegate, releaseSoundDelegate); m_buyCharacterBtn.AddSoundDelegates(pressSoundDelegate, releaseSoundDelegate); m_charSelectShareBtn.AddSoundDelegates(pressSoundDelegate, releaseSoundDelegate); // Store delegate for when number of owned characters changes m_ownedCharCountChangedDelegate = ownedCharCountChangedDelegate; // Initialize text m_characterNameText.Initialize(); m_characterPriceText.Initialize(); m_characterCountText.Initialize(); // Initialize character list m_characterResource = characterResource; InitializeCharacterScrollPanel(sceneMaster); UpdateCharacterCountText(); // Set the initialized flag m_isInitialized = true; }
/// <summary> /// Initializes this instance. /// </summary> public void Initialize(CharacterResource characterResource, NewCharWinAnimator newCharWinAnim, Vector3 initialCharacterRotation, System.EventHandler <System.EventArgs> openGachaDelegate, System.EventHandler <System.EventArgs> gachaPlayDelegate, System.EventHandler <System.EventArgs> gachaShareDelegate, System.EventHandler <System.EventArgs> repeatGachaDelegate, System.EventHandler <System.EventArgs> gachaOpenedDelegate, System.EventHandler <System.EventArgs> pressSoundDelegate, System.EventHandler <System.EventArgs> releaseSoundDelegate) { m_characterResource = characterResource; m_newCharWinAnim = newCharWinAnim; // Set the initial rotation for characters in character select m_initialRotation = initialCharacterRotation; // Initialize buttons m_openGachaBtn.Initialize(openGachaDelegate, UIButton.TriggerType.ON_RELEASE); m_gachaPlayBtn.Initialize(gachaPlayDelegate, UIButton.TriggerType.ON_RELEASE); m_gachaShareBtn.Initialize(gachaShareDelegate, UIButton.TriggerType.ON_RELEASE); m_repeatGachaBtn.Initialize(repeatGachaDelegate, UIButton.TriggerType.ON_RELEASE); // Set button sounds m_openGachaBtn.AddSoundDelegates(pressSoundDelegate, releaseSoundDelegate); m_gachaPlayBtn.AddSoundDelegates(pressSoundDelegate, releaseSoundDelegate); m_gachaShareBtn.AddSoundDelegates(pressSoundDelegate, releaseSoundDelegate); m_repeatGachaBtn.AddSoundDelegates(pressSoundDelegate, releaseSoundDelegate); // Initialize invisible button for gacha machine lever m_gachaMachineLever.Initialize(openGachaDelegate, UIButton.TriggerType.ON_PRESS); // Initialize text m_characterNameText.Initialize(); m_prizeLabelText.Initialize(); // Get delegate to call when gacha has been opened m_gachaOpenedDelegate = gachaOpenedDelegate; // Set scale of gacha machine depending on device orientation float newScale = Locator.GetUIManager().UICamera.IsLandscape ? m_gachaMachineLandscapeScale : m_gachaMachinePortraitScale; m_gachaAnim.transform.localScale = Vector3.one * newScale; // Initialize gacha overlay UI animator // State 1: 1 alpha, covering gacha and entire screen // State 2: 0 alpha, revealing gacha prize m_gachaOverlayAnimator = new UIAnimator(m_gachaOverlay); m_gachaOverlayAnimator.SetAlphaAnimation(1.0f, 0.0f); m_gachaOverlayAnimator.SetAnimTime(m_gachaOverlayAnimTime); m_gachaOverlayAnimator.ResetToState1(); // Note gacha animator's initial speed m_gachaAnimInitialSpeed = m_gachaAnim.speed; // Reset state (should come after initializing other values) Reset(); // Set the initialized flag m_isInitialized = true; }