private void PlayBigCharacterQuote(Notification quote, string text, string soundName, float durationSeconds) { if (this.m_quote != null) { UnityEngine.Object.Destroy(this.m_quote.gameObject); } this.m_quote = quote; this.m_quote.ChangeText(text); TransformUtil.AttachAndPreserveLocalTransform(this.m_quote.transform, Board.Get().FindBone("OffScreenSpeaker1")); this.m_quote.transform.localPosition = Vector3.zero; this.m_quote.transform.localScale = (Vector3)(Vector3.one * 0.01f); this.m_quote.transform.localEulerAngles = Vector3.zero; if (!string.IsNullOrEmpty(soundName)) { QuoteSoundCallbackData callbackData = new QuoteSoundCallbackData { m_quote = this.m_quote, m_durationSeconds = durationSeconds }; AssetLoader.Get().LoadSound(soundName, new AssetLoader.GameObjectCallback(this.OnBigQuoteSoundLoaded), callbackData, false, SoundManager.Get().GetPlaceholderSound()); } else { this.m_quote.PlayBirthWithForcedScale(Vector3.one); if (durationSeconds > 0f) { this.DestroyNotification(this.m_quote, durationSeconds); } } }
public Spell GetSpell(SpellType spellType) { foreach (SpellTableEntry entry in this.m_Table) { if (entry.m_Type == spellType) { if ((entry.m_Spell == null) && (entry.m_SpellPrefabName != null)) { string name = FileUtils.GameAssetPathToName(entry.m_SpellPrefabName); GameObject obj2 = AssetLoader.Get().LoadActor(name, true, true); Spell spell = obj2.GetComponent <Spell>(); if (spell != null) { entry.m_Spell = spell; TransformUtil.AttachAndPreserveLocalTransform(obj2.transform, base.gameObject.transform); } } if (entry.m_Spell == null) { Debug.LogError(string.Concat(new object[] { "Unable to load spell ", spellType, " from spell table ", base.gameObject.name })); return(null); } Spell component = UnityEngine.Object.Instantiate <GameObject>(entry.m_Spell.gameObject).GetComponent <Spell>(); component.SetSpellType(spellType); return(component); } } return(null); }
private void SetupRarity() { GameObject obj2 = UnityEngine.Object.Instantiate <GameObject>(this.m_rarityInfo.gameObject); if (obj2 != null) { obj2.transform.parent = this.m_CardParent.transform; this.m_rarityInfo = obj2.GetComponent <PackOpeningCardRarityInfo>(); this.m_rarityInfo.m_RarityObject.SetActive(true); this.m_rarityInfo.m_HiddenCardObject.SetActive(true); Vector3 localPosition = this.m_rarityInfo.m_HiddenCardObject.transform.localPosition; this.m_rarityInfo.m_HiddenCardObject.transform.parent = this.m_CardParent.transform; this.m_rarityInfo.m_HiddenCardObject.transform.localPosition = localPosition; this.m_rarityInfo.m_HiddenCardObject.transform.localRotation = Quaternion.identity; this.m_rarityInfo.m_HiddenCardObject.transform.localScale = new Vector3(7.646f, 7.646f, 7.646f); TransformUtil.AttachAndPreserveLocalTransform(this.m_rarityInfo.m_RarityObject.transform, this.m_CardParent.transform); this.m_spell = this.m_rarityInfo.m_RarityObject.GetComponent <Spell>(); this.m_revealButton = this.m_rarityInfo.m_RarityObject.GetComponent <PegUIElement>(); if (UniversalInputManager.Get().IsTouchMode()) { this.m_revealButton.SetReceiveReleaseWithoutMouseDown(true); } this.m_SharedHiddenCardObject.transform.parent = this.m_rarityInfo.m_HiddenCardObject.transform; TransformUtil.Identity(this.m_SharedHiddenCardObject.transform); } }
public void AddGameObject(GameObject go, CanvasAnchor anchor = 0, bool destroyOnSceneLoad = false, CanvasScaleMode scaleMode = 1) { CanvasAnchors anchors = (scaleMode != CanvasScaleMode.HEIGHT) ? this.m_widthScale : this.m_heightScale; TransformUtil.AttachAndPreserveLocalTransform(go.transform, anchors.GetAnchor(anchor)); if (destroyOnSceneLoad) { this.DestroyOnSceneLoad(go); } }
protected void SetTransform() { if (this.m_menuParent == null) { this.m_menuParent = base.transform; } TransformUtil.AttachAndPreserveLocalTransform(this.m_menu.transform, this.m_menuParent); if (this.m_blocker != null) { this.m_blocker.transform.localPosition = new Vector3(0f, -5f, 0f); this.m_blocker.transform.eulerAngles = new Vector3(90f, 0f, 0f); } SceneUtils.SetLayer(this, GameLayer.UI); this.m_menu.gameObject.transform.localScale = this.NORMAL_SCALE; }
public void SetSpell(SpellType type, Spell spell) { foreach (SpellTableEntry entry in this.m_Table) { if (entry.m_Type == type) { if (entry.m_Spell == null) { entry.m_Spell = spell; TransformUtil.AttachAndPreserveLocalTransform(spell.gameObject.transform, base.gameObject.transform); } return; } } Debug.LogError(string.Concat(new object[] { "Set invalid spell type ", type, " in spell table ", base.gameObject.name })); }
public void CreatePopupDialogFromObject(Notification passedInNotification, string headlineString, string bodyText, string OkButtonText) { if (this.popUpDialog != null) { UnityEngine.Object.Destroy(this.popUpDialog.gameObject); } TransformUtil.AttachAndPreserveLocalTransform(passedInNotification.gameObject.transform, OverlayUI.Get().m_heightScale.m_Center); if (UniversalInputManager.UsePhoneUI != null) { passedInNotification.gameObject.transform.localScale = (Vector3)(1.5f * passedInNotification.gameObject.transform.localScale); } this.popUpDialog = passedInNotification; this.popUpDialog.ButtonStart.SetText(OkButtonText); this.popUpDialog.speechUberText.Text = bodyText; this.popUpDialog.headlineUberText.Text = headlineString; this.popUpDialog.PlayBirth(); UniversalInputManager.Get().SetGameDialogActive(true); }
private GameObject CreateRewardInstance(int rewardIndex, Vector3 rewardPos, bool activeOnStart) { RewardData data = this.m_Rewards[rewardIndex]; GameObject go = null; switch (data.RewardType) { case Reward.Type.ARCANE_DUST: { go = UnityEngine.Object.Instantiate <GameObject>(this.m_RewardSets.m_RewardDust); TransformUtil.AttachAndPreserveLocalTransform(go.transform, this.m_Root.transform); go.transform.position = rewardPos; go.SetActive(true); UberText componentInChildren = go.GetComponentInChildren <UberText>(); ArcaneDustRewardData data2 = (ArcaneDustRewardData)data; componentInChildren.Text = data2.Amount.ToString(); go.SetActive(activeOnStart); break; } case Reward.Type.BOOSTER_PACK: { BoosterPackRewardData data3 = data as BoosterPackRewardData; int id = data3.Id; if (id == 0) { id = 1; UnityEngine.Debug.LogWarning("RewardBoxesDisplay - booster reward is not valid. ID = 0"); } Log.Kyle.Print(string.Format("Booster DB ID: {0}", id), new object[0]); string assetName = GameDbf.Booster.GetRecord(id).GetAssetName("ARENA_PREFAB"); if (string.IsNullOrEmpty(assetName)) { UnityEngine.Debug.LogError(string.Format("RewardBoxesDisplay - no prefab found for booster {0}!", data3.Id)); } else { go = AssetLoader.Get().LoadGameObject(assetName, true, false); TransformUtil.AttachAndPreserveLocalTransform(go.transform, this.m_Root.transform); go.transform.position = rewardPos; go.SetActive(activeOnStart); } break; } case Reward.Type.CARD: { go = UnityEngine.Object.Instantiate <GameObject>(this.m_RewardSets.m_RewardCard); TransformUtil.AttachAndPreserveLocalTransform(go.transform, this.m_Root.transform); go.transform.position = rewardPos; go.SetActive(true); CardRewardData cardData = (CardRewardData)data; go.GetComponentInChildren <RewardCard>().LoadCard(cardData, this.m_layer); go.SetActive(activeOnStart); break; } case Reward.Type.CARD_BACK: { go = UnityEngine.Object.Instantiate <GameObject>(this.m_RewardSets.m_RewardCardBack); TransformUtil.AttachAndPreserveLocalTransform(go.transform, this.m_Root.transform); go.transform.position = rewardPos; go.SetActive(true); CardBackRewardData cardbackData = (CardBackRewardData)data; go.GetComponentInChildren <RewardCardBack>().LoadCardBack(cardbackData, this.m_layer); go.SetActive(activeOnStart); break; } case Reward.Type.GOLD: { go = UnityEngine.Object.Instantiate <GameObject>(this.m_RewardSets.m_RewardGold); TransformUtil.AttachAndPreserveLocalTransform(go.transform, this.m_Root.transform); go.transform.position = rewardPos; go.SetActive(true); UberText text2 = go.GetComponentInChildren <UberText>(); GoldRewardData data4 = (GoldRewardData)data; text2.Text = data4.Amount.ToString(); go.SetActive(activeOnStart); break; } } if (go == null) { UnityEngine.Debug.LogWarning("RewardBoxesDisplay: Unable to create reward, object null!"); return(null); } if (rewardIndex >= this.m_RewardObjects.Length) { UnityEngine.Debug.LogWarning("RewardBoxesDisplay: CreateRewardInstance reward index exceeded!"); return(null); } SceneUtils.SetLayer(go, this.m_layer); this.m_RewardObjects[rewardIndex] = go; this.m_InstancedObjects.Add(go); return(go); }