Inheritance: MonoBehaviour
Exemplo n.º 1
0
 /*  Unity API
  *  ==========================================================================*/
 void Start()
 {
     if(instance == null)
         instance = this;
     else
         throw new Exception("Attempted to instantiate two PopupManagers, but PopupManager is a singleton.");
 }
    /// <summary>
    /// Initialize the controller.
    /// </summary>
    private void Awake()
    {
        m_startPosition = transform.position;
        m_startRotation = transform.rotation;

        popManager = GetComponent<PopupManager> ();
    }
Exemplo n.º 3
0
	public void onDestory ()
	{
		Destroy (popObj);
		Destroy (current);
		DestroyObject (container);
		current = null;
		container = null;
		isPopup = false;
		bg.SetActive (isPopup);
	}
Exemplo n.º 4
0
    public void Show(PopupManager.Type type)
    {
        switch (type) {
        case Type.EndGame:
            currentPopup = popups[0];
            break;
        case Type.Pause:
            currentPopup = popups[1];
            break;
        }

        SetVisibilityAlphaMask(true);
        currentPopup.SetActive(true);
    }
Exemplo n.º 5
0
    void Awake()
    {
        if (_instance)
        {
            Destroy(gameObject);
        }
        else
        {
            _instance = this;

            _rectTransform = Popup.GetComponent<RectTransform>();

            _rectTransform.anchorMin = new Vector2(1.05f, _rectTransform.anchorMin.y);
            _rectTransform.anchorMax = new Vector2(1.3754727f, _rectTransform.anchorMax.y);
        }
    }
Exemplo n.º 6
0
        public Platform(Context context, bool embedded)
        {
            _embedded   = embedded;
            _context    = context;
            PackageName = context?.PackageName;
            _renderer   = new PlatformRenderer(context, this);
            var activity = _context.GetActivity();

            if (embedded && activity != null)
            {
                // Set up handling of DisplayAlert/DisplayActionSheet/UpdateProgressBarVisibility
                if (_context == null)
                {
                    // Can't show dialogs if it's not an activity
                    return;
                }

                PopupManager.Subscribe(_context.GetActivity());
                return;
            }

            FormsAppCompatActivity.BackPressed += HandleBackPressed;
        }
Exemplo n.º 7
0
    public void MakePopupPanel()
    {
        if (!game.IsLocalPlayersTurn())
        {
            return;
        }

        PopupManager popup = PopupManager.Instance;

        //This is going off the assumption that we currently only have one player at a time
        FireMan fireman = game.GetLocalFireman();

        if (GetStatus() != WallStatus.DESTROYED)
        {
            int    cost = fireman.determineCost(ActionType.CHOP);
            string msg  = string.Format("Chop Wall: {0} AP", cost);
            popup.AddButton(msg, delegate { fireman.ChopWall(this); });
        }

        Vector2 position = gameObject.GetComponent <RectTransform>().anchoredPosition;

        //bad Sarah
        Vector3 rotation = gameObject.GetComponent <RectTransform>().rotation.eulerAngles;

        //if the edge is vertical, offset the popup by less
        if (rotation.Equals(Vector3.zero))
        {
            position.x += 160;
        }
        else
        {
            position.x += 320;
        }


        popup.SetPositionAndShow(position);
    }
Exemplo n.º 8
0
    private void Download()
    {
        bool isDownloadAll = AppConfig.Instance.version + "DownloadAll" == PlayerPrefs.GetString("IsDownloadAll");

        Debug.LogError(isDownloadAll);
        var window = PopupManager.ShowWindow <DownloadAllWindow>("GameMain/Prefabs/DownloadAllWindow");

        if (isDownloadAll)
        {
            window.SetData(true);
        }
        else
        {
            if (CacheManager.GetDownloadAllSize() != 0)
            {
                var size = Math.Round(CacheManager.GetDownloadAllSize() * 1f / 1048576f, 2);
                window.SetData(false, I18NManager.Get("GameMain_DownloadWindow3", size));
            }
            else
            {
                window.SetData(true);
                PlayerPrefs.SetString("IsDownloadAll", "FinishDownloadAll");
            }
        }

        window.WindowActionCallback = evt =>
        {
            if (evt == WindowEvent.Yes)
            {
                CacheManager.DownloadAllAudio((s =>
                {
                    PlayerPrefs.SetString("IsDownloadAll", AppConfig.Instance.version + "DownloadAll");
                    FlowText.ShowMessage(I18NManager.Get("GameMain_SetPanelDownloadFinishHint1"));
                }));
            }
        };
    }
Exemplo n.º 9
0
    void OnTriggerEnterQuestObject(Collider other)
    {
        //update quest process data
        ObjectInGame obj = other.GetComponent <ObjectInGame>();
        Transform    pos = this.transform.findChildRecursively("wrong_marker");

        if (obj && obj.isCombinableObject() && other.gameObject.GetPhotonView().viewID == 0)
        {
            SendTriggerQuestItem = true;
            other.gameObject.SetActive(false);
            Item      otherData = other.gameObject.GetComponent <Item>();
            QuestData q         = listQuestData.Find(x => x.requireItemId == otherData.Id);
            if (q != null && !QuestManager.instance.isFinishQuest(q))
            {
                FBPoolManager.instance.returnObjectToPool(other.gameObject);
                QuestManager.instance.UpdateQuestProcess(q, +1);
                FBParticleManager.PlayEffect(FBParticleManager.EFFECT_COMBINE_OBJECT, 2, pos ? pos.position : this.transform.position);
                FBSoundManager.Play(FBSoundManager.COMBINE_SOUND);
                Invoke("ResetSendTrigger", 2f);
            }
            else
            {
                if (pos)
                {
                    PopupManager.ShowWrongSignal(pos.position);
                }
                else
                {
                    PopupManager.ShowWrongSignal(this.transform.position);
                }
            }
        }
        else
        {
            FBPoolManager.instance.returnObjectToPool(other.gameObject);
        }
    }
Exemplo n.º 10
0
        private void CreateOptionPopup()
        {
            var popup = PopupManager.Request(this.optionPopupPrefab);

            popup.BGMSlider.value = GameSystem.Instance.User.Option.BGMVolume.Value;
            popup.SESlider.value  = GameSystem.Instance.User.Option.SEVolume.Value;

            popup.BGMSlider.OnValueChangedAsObservable()
            .Subscribe(x =>
            {
                GameSystem.Instance.User.Option.BGMVolume.Value = x;
            })
            .AddTo(this);

            popup.SESlider.OnValueChangedAsObservable()
            .Subscribe(x =>
            {
                GameSystem.Instance.User.Option.SEVolume.Value = x;
            })
            .AddTo(this);

            popup.DeleteSaveDataButton.OnClickAsObservable()
            .SubscribeWithState(this, (_, _this) =>
            {
                _this.ConfirmDeleteSaveData();
            })
            .AddTo(this);

            popup.CloseButton.OnClickAsObservable()
            .SubscribeWithState(popup, (_, _popup) =>
            {
                _popup.Close();
            })
            .AddTo(this);

            popup.Open();
        }
Exemplo n.º 11
0
        private void BuildScreen_Loaded(object sender, RoutedEventArgs e)
        {
            // Load the game component.
            _token = new UserToken()
            {
                AuthKey = Settings.UserAuthKey
            };

            ctlWait.Hide();

            PopupManager.Init(this.PopupContainer);

            // Stop issuing commands to the server.
            ServerManager.Instance.Reset();

            _dragDropManager             = new DragDropManager(this.LayoutRoot);
            lstCreatures.DragDropManager = _dragDropManager;
            lstItems.DragDropManager     = _dragDropManager;
            lstNpcs.DragDropManager      = _dragDropManager;
            lstQuests.DragDropManager    = _dragDropManager;
            lstCreatures.EnableDrag      = true;
            lstItems.EnableDrag          = true;
            lstNpcs.EnableDrag           = true;
            lstQuests.EnableDrag         = true;

            ctlMap.StatusUpdated   += new MapEditor.StatusUpdatedEventHandler(ctlMap_StatusUpdated);
            ctlMap.PlaceChanged    += new PlaceEventHanlder(ctlMap_PlaceChanged);
            ctlMap.MapLoadComplete += new EventHandler(ctlMap_MapLoadComplete);

            ctlProperties.PropertyChanged += new PropertyChangedEventHandler(ctlProperties_PropertyChanged);
            ctlActors.EnableDrag           = true;
            ctlActors.ActorDrop           += new ActorEventHandler(ctlActors_ActorDrop);
            ctlActors.ActorClick          += new ActorEventHandler(ctlActors_ActorClick);

            this.LoadTemplates();
        }
Exemplo n.º 12
0
        private void MenuElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;
            if (this.Item != null)
            {
                ContextMenu.ContextMenuType cmType = ContextMenu.ContextMenuType.Item;
                switch (this.SlotType)
                {
                case ItemSlotType.Equipment:
                    cmType = ContextMenu.ContextMenuType.Equipment;
                    break;

                case ItemSlotType.Action:
                    cmType = ContextMenu.ContextMenuType.Action;
                    break;
                }
                _context               = new ContextMenu(cmType, this.Item);
                _context.Click        += new ActionEventHandler(OnContextMenuClick);
                _context.CreateAction += new CreateActionEventHandler(OnContextCreateAction);
                _context.MouseLeave   += new MouseEventHandler(OnContextMouseLeave);

                PopupManager.Add(_context, e.GetPosition(null));
            }
        }
Exemplo n.º 13
0
        public static void DownloadAllAudio(Action <string> onComplete = null, string tag = null)
        {
            _onComplete = onComplete;
            _tag        = tag;

            ResIndex resIndex = GetIndexFile(ResPath.AllAudioIndex);
            ResPack  resPack  = resIndex.packageDict["AllAudio"];

            _releasePath = resPack.releasePath;
            if (resPack.packageType == FileType.Zip)
            {
                ResItem item = new ResItem()
                {
                    Md5  = resPack.packageMd5,
                    Path = AppConfig.Instance.assetsServer + "/" + AppConfig.Instance.version + "/" +
                           resPack.downloadPath,
                    Size     = resPack.packageSize,
                    FileType = resPack.packageType
                };

                _downloadingWindow          = PopupManager.ShowWindow <DownloadingWindow>(Constants.DownloadingWindowPath);
                _downloadingWindow.Content  = I18NManager.Get("Download_Downloading");
                _downloadingWindow.Progress = I18NManager.Get("Download_Progress", 0);
                var downItem = DownloadManager.Load(item, AssetLoader.ExternalDownloadPath + "/" + resPack.downloadPath,
                                                    OnComplete,
                                                    OnError, OnProgressAll);

                _downloadingWindow.WindowActionCallback = evt =>
                {
                    if (evt == WindowEvent.Cancel)
                    {
                        downItem.Cancel();
                    }
                };
            }
        }
Exemplo n.º 14
0
    void Awake()
    {
        _gm                   = FindObjectOfType <GameManager>();
        _popupManager         = FindObjectOfType <PopupManager>();
        _user                 = _gm.User;
        _user.OnMinionBought += SetBoughtScrollButtons;

        var config = GameUtils.LoadConfig <GenericListJsonLoader <MinionStoreData> >
                         ("StoreMinionsData.json"
                         , GameUtils.MINION_CONFIG_PATH);

        _storeInfoData = new Dictionary <MinionType, MinionStoreData>();

        foreach (var item in config.list)
        {
            var minionType = (MinionType)Enum.Parse(typeof(MinionType), item.type);
            _storeInfoData.Add(minionType, item);
        }

        FillScrollList();
        SetBoughtScrollButtons();

        FillSelectedList();
    }
Exemplo n.º 15
0
    public void SyncUserHighscore()
    {
        TaskScheduler taskScheduler = TaskScheduler.FromCurrentSynchronizationContext();

        PopupManager.Get().OpenLoading("", "Synchronizing Your Data With Server...");
        int localHighScore = PlayerPrefs.GetInt("highscore", 0);

        ReceiveUserHighScore().ContinueWith(task =>
        {
            int serverHighScore = task.Result;
            if (serverHighScore != -1 && serverHighScore != localHighScore)
            {
                if (serverHighScore < localHighScore)
                {
                    PostUserHighScore(localHighScore).ContinueWith(t => { });
                }
                else
                {
                    localHighScore = serverHighScore;
                }
            }
            StartCoroutine(SyncUserHighscoreCoroutine(localHighScore));
        }, taskScheduler);
    }
Exemplo n.º 16
0
        private void ShowKeyTips()
        {
            if (_showKeyTipsTimer != null)
            {
                _showKeyTipsTimer.Stop();
            }

            if (State == KeyTipState.Pending)
            {
                Debug.Assert(globalScope != null);

                PopupManager.CloseAll();

                if (PushKeyTipsScope(globalScope))
                {
                    State = KeyTipState.Enabled;
                    RaiseKeyTipEnterFocus();
                }
                else
                {
                    LeaveKeyTipMode();
                }
            }
        }
Exemplo n.º 17
0
 private void Start()
 {
     SetCredits(0);
     SetFuel(100);
     SetHullPercent(100);
     SetEnginePercent(100);
     logScreen    = GameObject.Find("LogScreen").GetComponent <LogScreen>();
     popupManager = GameObject.Find("GameScreen").GetComponent <PopupManager>();
     cameraShaker = Camera.main.GetComponent <CameraShaker>();
     registry     = GameObject.Find("Registry").GetComponent <Registry>();
     playerShip   = GameObject.Find("PlayerShip").GetComponent <PlayerShip>();
     fadeInAndOut = GameObject.Find("Fader").GetComponent <FadeInAndOut>();
     registry.SetNumberOfPeopleSacrificed(0);
     fuelAndRepairCooldownReset = 5f;
     fuelAndRepairCooldown      = fuelAndRepairCooldownReset;
     jobCooldownReset           = 10f;
     jobCooldown    = 0;
     doFuel         = false;
     doRepair       = false;
     doJob          = false;
     jobOneSelected = false;
     stage          = 0;
     mm.PlaySound(mm.music[GetRandomNumber(1, 4)]);
 }
Exemplo n.º 18
0
    private void OnOkBtn()
    {
        var playGemNum = GlobalData.PlayerModel.PlayerVo.Gem;

        if (playGemNum >= _gem)
        {
            WindowEvent = WindowEvent.Ok;
            base.Close();
        }
        else
        {
            string content = I18NManager.Get("CoaxSleep_GoShop");
            string okTxt   = I18NManager.Get("CoaxSleep_GoShopOkTxt");
            var    window  = PopupManager.ShowConfirmWindow(content, null, okTxt);
            window.WindowActionCallback = evt =>
            {
                if (evt != WindowEvent.Cancel)
                {
                    GoToShop();
                }
            };
            base.Close();
        }
    }
Exemplo n.º 19
0
    private void OnSweep(SweepRes res)
    {
        _model.UpdateMyLevel(res.UserLevel);

        LoadingOverlay.Instance.Hide();

        EventDispatcher.RemoveEvent(EventConst.ShowLastBattleWindow);
        EventDispatcher.AddEventListener(EventConst.ShowLastBattleWindow, OnSweepEnd);

        RepeatedField <GameResultPB> result = res.GameResult;
        BattleSweepWindow            win    = PopupManager.ShowWindow <BattleSweepWindow>("MainLine/Prefabs/BattleSweepWindow");

        win.SetData(res.GameResult, ClientData.CustomerSelectedLevel, result[0].Exp);
        win.MaskColor = new Color(0, 0, 0, 0.5f);

        if (_model.JumpData != null && GlobalData.PropModel.GetUserProp(_model.JumpData.RequireId).Num >=
            _model.JumpData.RequireNum)
        {
            FlowText.ShowMessage(I18NManager.Get("MainLine_Hint1"));
        }

        for (int i = 0; i < result.Count; i++)
        {
            GameResultPB pb = result[i];
            GlobalData.PlayerModel.AddExp(pb.Exp);
        }

        GlobalData.PlayerModel.UpdateUserPower(res.UserPower);

        GlobalData.RandomEventModel.AddEnergy(ClientData.CustomerSelectedLevel.CostEnergy * result.Count);

        if (GlobalData.RandomEventModel.CheckTrigger(7002, 7003))
        {
            new TriggerService().ShowNewGiftWindow().Execute();
        }
    }
Exemplo n.º 20
0
        public static void DownloadEvoCard(int cardId, Action <string> onComplete = null, string tag = null)
        {
            _onComplete = onComplete;
            _tag        = tag;

            ResIndex resIndex = GetIndexFile(ResPath.EvoCardIndex);
            ResPack  resPack  = resIndex.packageDict["EvoCard"];

            string  id      = cardId + ".bytes";
            ResItem resItem = null;

            foreach (var item in resPack.items)
            {
                if (item.Path == id)
                {
                    resItem = item;
                    break;
                }
            }

            if (resItem == null)
            {
                FlowText.ShowMessage(I18NManager.Get("Download_IndexNoExist") + cardId);
            }
            else
            {
                resItem.Path = AppConfig.Instance.assetsServer + "/" + AppConfig.Instance.version + "/" +
                               resPack.downloadPath + "/" + id;

                _downloadingWindow          = PopupManager.ShowWindow <DownloadingWindow>(Constants.DownloadingWindowPath);
                _downloadingWindow.Content  = I18NManager.Get("Download_Downloading");
                _downloadingWindow.Progress = I18NManager.Get("Download_Progress", 0);
                DownloadManager.Load(resItem, AssetLoader.ExternalHotfixPath + "/" + resPack.releasePath + "/" + id,
                                     OnCompleteEvoCard, OnErrorEvoCard, OnProgress);
            }
        }
Exemplo n.º 21
0
    public override void OnMessage(Message message)
    {
        string name = message.Name;

        object[] body = message.Params;
        switch (name)
        {
        case MessageConst.CMD_VISIT_WEATHER_JUMP_CLICK:
            Debug.Log("CMD_VISIT_WEATHER_JUMP_CLICK");
            if (_curVisitVo.CurWeather == VISIT_WEATHER.Fine)
            {
                SendMessage(new Message(MessageConst.MODULE_VISIT_SHOW_LEVEL_PANEL, Message.MessageReciverType.DEFAULT, _curVisitVo.NpcId));
            }
            else
            {
                PopupManager.ShowConfirmWindow(I18NManager.Get("Visit_Weather_Tips"), I18NManager.Get("Common_OK2")).WindowActionCallback = evt =>
                {
                    if (evt == WindowEvent.Ok)
                    {
                        SendMessage(new Message(MessageConst.MODULE_VISIT_SHOW_LEVEL_PANEL, Message.MessageReciverType.DEFAULT, _curVisitVo.NpcId));
                    }
                };
            }
            break;

        case MessageConst.CMD_VISIT_WEATHER_BLESSING_CLICK:
            Debug.Log("CMD_VISIT_WEATHER_BLESSING_CLICK");
            BlessResult result = (BlessResult)body[0];
            SendBlessingMsg(result);
            break;

        case MessageConst.CMD_VISIT_WEATHER_RESULT_CLICK:
            OnClickResultMask();
            break;
        }
    }
Exemplo n.º 22
0
 //注意这里返回值一定是 IEnumerator
 /// <summary>
 /// 统一 异步加载场景
 /// </summary>
 /// <param name="sceneName"></param>
 /// <returns></returns>
 public static IEnumerator LoadScene(string sceneName)
 {
     Debug.LogFormat("开始加载场景,scene name is {0}", sceneName);
     if (!isLoading)
     {
         isLoading = true;
         GameObject     go       = PopupManager.AddWindow(PopupWindowName.LOADING_PANEL);
         Text           progress = go.transform.Find("TitleText").gameObject.GetComponent <Text>();
         AsyncOperation async    = SceneManager.LoadSceneAsync(sceneName);
         while (!async.isDone)
         {
             //  Debug.Log(async.progress);
             progress.text = (int)(async.progress * 100) + "%";
             yield return(new WaitForEndOfFrame());//<strong>加上这么一句就可以先显示加载画面然后再进行加载</strong>
         }
         //读取完毕后返回, 系统会自动进入C场景
         yield return(async);
     }
     else
     {
         Debug.Log("loading is acting !!! ");
         yield return(null);
     }
 }
Exemplo n.º 23
0
 public override void onEvent(GameWonEvent evt)
 {
     mTime.Visibility      = ViewStates.Gone;
     mTimeImage.Visibility = ViewStates.Gone;
     PopupManager.showPopupWon(evt.GameState);
 }
Exemplo n.º 24
0
    private void SetProgress()
    {
        SetProgressData();

        for (int i = 0; i < _tabBarTran.childCount; i++)
        {
            int weight  = _missionModel.GetPlayerBirthdayWeight(i);
            var frameBg = _tabBarTran.GetChild(i).Find("FrameBg");
            var icon    = frameBg.GetRawImage("Icon");
            var redDot  = frameBg.Find("RedDot");
            var num     = _tabBarTran.GetChild(i).GetText("WeightTxt");
            num.text = weight.ToString();
            var mask    = _tabBarTran.GetChild(i).Find("Mask");
            var iconNum = frameBg.GetText("IconNum");
            var rewards = _missionModel.GetPlayerBirthdayRewardPBByCount(weight);
            PointerClickListener.Get(icon.gameObject).onClick = null;
            bool isGift = rewards.Count > 1;
            if (!isGift)
            {
                RewardVo vo = new RewardVo(rewards[0]);
                icon.texture = ResourceManager.Load <Texture>(vo.IconPath);
                icon.gameObject.Show();
                icon.transform.GetChild(0).gameObject.SetActive(vo.Resource == ResourcePB.Puzzle);
                iconNum.text = vo.Num.ToString();
            }
            else
            {
                string path = "Prop/GiftPack/tongyong2";
                icon.texture = ResourceManager.Load <Texture>(path);
                icon.gameObject.Show();
                iconNum.transform.gameObject.Hide();
                icon.transform.GetChild(0).gameObject.Hide();
            }

            //是否初始化
            if (_missionModel.PlayerBirthdayInfoPb == null)
            {
                redDot.gameObject.Hide();
                mask.gameObject.Hide();
                PointerClickListener.Get(icon.gameObject).onClick = go =>
                {
                    if (!isGift)
                    {
                        FlowText.ShowMessage(ClientData.GetItemDescById(rewards[0].ResourceId, rewards[0].Resource).ItemDesc);
                    }
                    else
                    {
                        //打开奖励预览窗口
                        var window = PopupManager.ShowWindow <CommonAwardWindow>("GameMain/Prefabs/AwardWindow/CommonAwardWindow");
                        window.SetData(rewards.ToList(), true, ModuleConfig.MODULE_PLAYERBIRTHDAY);
                    }
                };
            }
            else
            {
                //是否领取过 isGet为true领取过,false未领取
                var isGet = _missionModel.PlayerBirthdayInfoPb.List.Contains(weight);
                //是否可以领取 isMayGet为true可以领,false未领取
                var isMayGet = _missionModel.PlayerBirthdayInfoPb.Progress >= weight;
                if (isMayGet && !isGet)                      //可以领,没领过
                {
                    redDot.gameObject.Show();

                    PointerClickListener.Get(icon.gameObject).onClick = go =>
                    {
                        SendMessage(new Message(MessageConst.CMD_PLAYER_BIRTHDAY_ACTIVE_REWARD, Message.MessageReciverType.CONTROLLER, MissionTypePB.ChiYuMission, weight));
                    };
                }
                else if (isMayGet && isGet)                      //可以领,领过了
                {
                    frameBg.gameObject.Hide();
                    mask.gameObject.Show();
                }
                else if (!isMayGet)                       //不可以领
                {
                    redDot.gameObject.Hide();
                    mask.gameObject.Hide();
                    PointerClickListener.Get(icon.gameObject).onClick = go =>
                    {
                        if (!isGet)
                        {
                            FlowText.ShowMessage(ClientData.GetItemDescById(rewards[0].ResourceId, rewards[0].Resource).ItemDesc);
                        }
                        else
                        {
                            //打开奖励预览窗口
                            var window = PopupManager.ShowWindow <CommonAwardWindow>("GameMain/Prefabs/AwardWindow/CommonAwardWindow");
                            window.SetData(rewards.ToList(), true, ModuleConfig.MODULE_PLAYERBIRTHDAY);
                        }
                    };
                }
            }
        }
    }
Exemplo n.º 25
0
    private IEnumerator CreateTreasure()
    {
        if (!popupscript)
        {
            popupscript = GameObject.FindGameObjectWithTag("PopupManager").GetComponent <PopupManager>();
        }
        GameObject rubble = Instantiate(rubble2, transform.position + direction * distance, rubble2.transform.rotation) as GameObject;

        yield return(new WaitForSeconds(2f));

        Collider[] pilecolls = gameObject.GetComponentsInChildren <Collider>();
        foreach (Collider c in pilecolls)
        {
            c.enabled = false;
        }
        Renderer[] pilerend = gameObject.GetComponentsInChildren <Renderer>();
        foreach (Renderer r in pilerend)
        {
            r.enabled = false;
        }

        if (randomArtifact >= 70)
        {
            if (!artifactmade)
            {
                if (CaveMound)
                {
                    direction = gameObject.transform.right;
                    distance  = 1;
                }
                if (!CaveMound)
                {
                    direction = gameObject.transform.up;
                    distance  = 1;
                }
                weaponismade = true;

                if (!ItemInventory.has3doconsole)
                {
                    GameObject artifact = Instantiate(gameconsole, transform.position + direction * distance, gameconsole.transform.rotation) as GameObject;
                    artifact.transform.parent = null;
                    artifactmade = true;
                    StopCoroutine(CreateTreasure());
                }
                else
                {
                    if (!ItemInventory.hasPottery)
                    {
                        GameObject artifact = Instantiate(pottery, transform.position + direction * distance, pottery.transform.rotation) as GameObject;
                        artifact.transform.parent = null;
                        artifactmade = true;
                        StopCoroutine(CreateTreasure());
                    }
                    else
                    {
                        if (!ItemInventory.hasCrucible)
                        {
                            GameObject artifact = Instantiate(crucible, transform.position + direction * distance, crucible.transform.rotation) as GameObject;
                            artifact.transform.parent = null;
                            artifactmade = true;
                            StopCoroutine(CreateTreasure());
                        }
                        else
                        {
                            if (!ItemInventory.hasStatuette)
                            {
                                GameObject artifact = Instantiate(statuette, transform.position + direction * distance, statuette.transform.rotation) as GameObject;
                                artifact.transform.parent = null;
                                artifactmade = true;
                                StopCoroutine(CreateTreasure());
                            }
                            else
                            {
                                if (!ItemInventory.hasToytrain)
                                {
                                    GameObject artifact = Instantiate(toytrain, transform.position + direction * distance, toytrain.transform.rotation) as GameObject;
                                    artifact.transform.parent = null;
                                    artifactmade = true;

                                    StopCoroutine(CreateTreasure());
                                }
                                else
                                {
                                    if (!ItemInventory.hasVintagephone)
                                    {
                                        GameObject artifact = Instantiate(telephone, transform.position + direction * distance, telephone.transform.rotation) as GameObject;
                                        artifact.transform.parent = null;
                                        artifactmade = true;
                                        StopCoroutine(CreateTreasure());
                                    }
                                    else
                                    {
                                        if (!ItemInventory.hasGoblet)
                                        {
                                            GameObject artifact = Instantiate(goblet, transform.position + direction * distance, goblet.transform.rotation) as GameObject;
                                            artifact.transform.parent = null;
                                            artifactmade = true;

                                            StopCoroutine(CreateTreasure());
                                        }
                                        else
                                        {
                                            if (!ItemInventory.hasBaseballcap)
                                            {
                                                GameObject artifact = Instantiate(cap, transform.position + direction * distance, cap.transform.rotation) as GameObject;
                                                artifact.transform.parent = null;
                                                artifactmade = true;
                                                StopCoroutine(CreateTreasure());
                                            }
                                            else
                                            {
                                                if (!ItemInventory.hasHuntinghorn)
                                                {
                                                    GameObject artifact = Instantiate(horn, transform.position + direction * distance, horn.transform.rotation) as GameObject;
                                                    artifact.transform.parent = null;
                                                    artifactmade = true;
                                                    StopCoroutine(CreateTreasure());
                                                }
                                                else
                                                {
                                                    if (!ItemInventory.hasOldbottle)
                                                    {
                                                        GameObject artifact = Instantiate(bottle, transform.position + direction * distance, bottle.transform.rotation) as GameObject;
                                                        artifact.transform.parent = null;
                                                        artifactmade = true;
                                                        StopCoroutine(CreateTreasure());
                                                    }
                                                    else
                                                    {
                                                        weaponismade = false;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if (!weaponismade)
        {
            weaponIndex = Random.Range(0, weapons.Length);

            if (CaveMound)
            {
                direction = gameObject.transform.right;
                distance  = 1;
            }
            if (!CaveMound)
            {
                direction = gameObject.transform.up;
                distance  = 1;
            }

            GameObject newweapon = Instantiate(weapons[weaponIndex], transform.position + direction * distance, weapons[weaponIndex].transform.rotation) as GameObject;


            //weaponismade = true;
            //yield return new WaitForFixedUpdate();
            newweapon.transform.parent = null;
            weaponstats = newweapon.GetComponent <WeaponStats>();
            weaponstats.WeaponStrength = Random.Range(10, 20) * levelmultiplier;
            materialIndex      = Random.Range(0, swordMaterialRef.Length);
            weaponstats.matInt = materialIndex;

            rend = newweapon.GetComponentsInChildren <Renderer>();
            if (CaveMound)
            {
                Vector3 fixPos = new Vector3(0, -1, 0);
                //Vector3 fixPos = gameObject.transform.position + (gameObject.transform.right * 1.1f );
                newweapon.transform.localPosition = newweapon.transform.position + fixPos;
            }

            if (newweapon.name == "battleaxe(Clone)")
            {
                Renderer axerend = newweapon.transform.Find("pCylinder8").GetComponent <Renderer>();



                axerend.sharedMaterial = hammerMaterialRef[materialIndex];
                Debug.Log("Created" + newweapon.name);
            }
            if (newweapon.name == "spear(Clone)")
            {
                rendererIndex = 0;
                foreach (Renderer i in rend)
                {
                    rend[rendererIndex].sharedMaterial = swordMaterialRef[materialIndex];
                    rendererIndex++;
                }
                //rend[rendererIndex].sharedMaterial = swordMaterialRef[materialIndex];
                rendererIndex = 0;



                //rend[rendererIndex].material = swordMaterialRef[materialIndex];
                Debug.Log("Created" + newweapon.name);
            }
            if (newweapon.name == "lowpolysword(Clone)")
            {
                rendererIndex = 0;
                foreach (Renderer i in rend)
                {
                    rend[rendererIndex].sharedMaterial = swordMaterialRef[materialIndex];
                    rendererIndex++;
                }
                //rend[rendererIndex].sharedMaterial = swordMaterialRef[materialIndex];
                rendererIndex = 0;



                //rend[rendererIndex].material = swordMaterialRef[materialIndex];
                //Debug.Log("Created" + newweapon.name);

                rend[rendererIndex].material = swordMaterialRef[materialIndex];
                Debug.Log("Created" + newweapon.name);
            }
            if (newweapon.name == "lowpolyhammer(Clone)")
            {
                rendererIndex = 0;
                foreach (Renderer i in rend)
                {
                    rend[rendererIndex].sharedMaterial = hammerMaterialRef[materialIndex];
                    rendererIndex++;
                }
                //rend[rendererIndex].sharedMaterial = swordMaterialRef[materialIndex];
                rendererIndex = 0;
                //rend[rendererIndex].material = swordMaterialRef[materialIndex];
                //Debug.Log("Created" + newweapon.name);

                //rend[rendererIndex].material = hammerMaterialRef[materialIndex];
                Debug.Log("Created" + newweapon.name);
            }
            if (newweapon.name == "lowpolymace(Clone)")
            {
                rendererIndex = 0;
                foreach (Renderer i in rend)
                {
                    rend[rendererIndex].sharedMaterial = maceMaterialRef[materialIndex];
                    rendererIndex++;
                }
                //rend[rendererIndex].sharedMaterial = swordMaterialRef[materialIndex];
                rendererIndex = 0;



                //rend[rendererIndex].material = swordMaterialRef[materialIndex];
                //Debug.Log("Created" + newweapon.name);

                //rend[rendererIndex].material = maceMaterialRef[materialIndex];
                Debug.Log("Created" + newweapon.name);
            }
            if (newweapon.name == "dualdaggers(Clone)")
            {
                rend          = newweapon.transform.Find("dagger1").GetComponentsInChildren <Renderer>();
                rendererIndex = 0;
                foreach (Renderer i in rend)
                {
                    rend[rendererIndex].sharedMaterial = swordMaterialRef[materialIndex];
                    rendererIndex++;
                }
                //rend[rendererIndex].sharedMaterial = swordMaterialRef[materialIndex];
                rendererIndex = 0;

                Renderer[] rend2 = newweapon.transform.Find("dagger2").GetComponentsInChildren <Renderer>();

                foreach (Renderer i in rend2)
                {
                    rend2[rendererIndex].sharedMaterial = swordMaterialRef[materialIndex];
                    rendererIndex++;
                }
                rendererIndex = 0;



                //rend[rendererIndex].material = swordMaterialRef[materialIndex];
                //Debug.Log("Created" + newweapon.name);

                //rend[rendererIndex].material = maceMaterialRef[materialIndex];
                Debug.Log("Created" + newweapon.name);
            }
            //Debug.Log("Created" + newweapon.name);
            newweapon.transform.SetParent(null);
            weaponismade = true;
            yield return(new WaitForSecondsRealtime(3));

            GameObject.Find("MoundLimiter").GetComponent <MoundLimit>().PopulateMoundList();
            Destroy(gameObject, 1);
            StopCoroutine(CreateTreasure());

            yield return(null);
        }
        weaponismade = true;
        yield return(null);
    }
Exemplo n.º 26
0
 /// <summary>
 /// 打开剧情窗口
 /// </summary>
 private void OpenStoryWindow()
 {
     _storyWindow = PopupManager.ShowWindow <ActivityMusicStoryWindow>("ActivityMusicTemplate/Prefabs/ActivityMusicStoryWindow");
     _storyWindow.SetData(_storyModel.GetUserStoryInfo);
 }
Exemplo n.º 27
0
        /// <summary>
        /// Updates the condition and DBH for the selected tree
        /// This is only used for the Update tree condition custom workflow
        /// </summary>
        internal static async Task UpdateIdentifiedFeature(ObservableCollection <OriginRelationshipViewModel> originRelatedRecords, Feature feature, PopupManager popupManager)
        {
            // if the webmap used in the app is not the tree dataset map, this method will not work
            if (WebmapURL != TreeDatasetWebmapUrl)
            {
                return;
            }

            // if there are no inspections available, reset condition and dbh and save feature
            if (originRelatedRecords.Count == 0)
            {
                feature.Attributes[TreeConditionAttribute] = "";
                feature.Attributes[TreeDBHAttribute]       = null;
                try
                {
                    await feature.FeatureTable.UpdateFeature(feature);

                    await feature.FeatureTable.ApplyEdits();
                }
                catch (Exception ex)
                {
                    UserPromptMessenger.Instance.RaiseMessageValueChanged(
                        Resources.GetString("ConditionDBH_UpdateError_Title"),
                        ex.Message,
                        true,
                        ex.StackTrace);
                }

                return;
            }

            var OrderedOriginRelationshipCollection = originRelatedRecords.OrderByDescending(x => x.PopupManager.DisplayedFields.First().Value);
            var lastInspection = OrderedOriginRelationshipCollection.First();

            // if the condition and dbh are still the same, do not update feature
            if (lastInspection.PopupManager.DisplayedFields.Where(x => x.Field.FieldName == InspectionConditionAttribute) ==
                popupManager.DisplayedFields.Where(x => x.Field.FieldName == TreeConditionAttribute) &&
                lastInspection.PopupManager.DisplayedFields.Where(x => x.Field.FieldName == InspectionDBHAttribute) ==
                popupManager.DisplayedFields.Where(x => x.Field.FieldName == TreeDBHAttribute))
            {
                return;
            }
            else
            {
                // set the new atributes
                // set the condition to empty string if user left it blank
                // set the dbh to 0 if user left it blank
                feature.Attributes[TreeConditionAttribute] =
                    lastInspection.PopupManager.DisplayedFields.Where(x => x.Field.FieldName == InspectionConditionAttribute).First().Value ?? "";
                feature.Attributes[TreeDBHAttribute] =
                    lastInspection.PopupManager.DisplayedFields.Where(x => x.Field.FieldName == InspectionDBHAttribute).First().Value ?? 0f;

                try
                {
                    await feature.FeatureTable.UpdateFeature(feature);

                    await feature.FeatureTable.ApplyEdits();
                }
                catch (Exception ex)
                {
                    UserPromptMessenger.Instance.RaiseMessageValueChanged(
                        Resources.GetString("ConditionDBH_UpdateError_Title"),
                        ex.Message,
                        true,
                        ex.StackTrace);
                }

                // HACK to refresh the popup manager when non editable fields are edited
                try
                {
                    if (!popupManager.IsEditing)
                    {
                        popupManager.StartEditing();
                    }
                    await popupManager.FinishEditingAsync();
                }
                catch
                {
                    popupManager.CancelEditing();
                }
            }
        }
Exemplo n.º 28
0
        // Declare the top level nav items

        /// <summary>
        ///     Initializes a new instance of the AppShell, sets the static 'Current' reference,
        ///     adds callbacks for Back requests and changes in the SplitView's DisplayMode, and
        ///     provide the nav menu list with the data to display.
        /// </summary>
        public AppShell()
        {
            InitializeComponent();

            Loading += async(sender, args) =>
            {
                // StatusBar is Mobile only
                if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();
                }
            };

            Loaded += async(sender, args) =>
            {
                Current = this;

                //TogglePaneButton.Focus(FocusState.Programmatic);
                NavMenuList.SelectedIndex = 0;
                var dm = DataModelServiceFactory.CurrentDataModelService();

#if SQLITE
                var trips = await dm.LoadTripsAsync();

                if (AppSettings.HasRun && trips.Any())
                {
                    // Load trips from DB
                    foreach (var trip in trips)
                    {
                        AddTrip(trip.Name, trip.Id);
                    }
                    var parameter = new TripNavigationParameter {
                        TripId = trips.First().Id
                    }.GetJson();
                    NavigateToPage(typeof(TripDetailPage), parameter);
                    LandingPage.Visibility = Visibility.Collapsed;
                }
                else
                {
                    LandingPage.ShowCreateFirstTrip = true;
                }
#else
                // When connecting to Azure, this is where we authenticate and then load the seed data into the local tables.
                // Then sync to the cloud
                bool isAuthenticated = false;
                while (!isAuthenticated)
                {
                    var authResponse = await dm.AuthenticateAsync();

                    isAuthenticated = authResponse.Item1;
                    if (!isAuthenticated)
                    {
                        var dialog = new MessageDialog(authResponse.Item2);
                        dialog.Commands.Add(new UICommand("OK"));
                        await dialog.ShowAsync();
                    }
                }

                await SetBusyAsync("Synchronising");

                var trips = await dm.LoadTripsAsync();
                await ClearBusyAsync();

                if (trips.Any())
                {
                    AppSettings.HasRun = true;

                    // Load trips from DB
                    foreach (var trip in trips)
                    {
                        AddTrip(trip.Name, trip.Id);
                    }
                    var parameter = new TripNavigationParameter {
                        TripId = trips.First().Id
                    }.GetJson();
                    NavigateToPage(typeof(TripDetailPage), parameter);
                    LandingPage.Visibility = Visibility.Collapsed;
                }
                else
                {
                    LandingPage.ShowCreateFirstTrip = true;
                }
#endif
            };

            RootSplitView.RegisterPropertyChangedCallback(
                SplitView.DisplayModeProperty,
                (s, a) =>
            {
                // Ensure that we update the reported size of the TogglePaneButton when the SplitView's
                // DisplayMode changes.
                CheckTogglePaneButtonSizeChanged();
            });

            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;
            PopupManager.Configure(this, ParentedPopup, HitBlocker);
        }
Exemplo n.º 29
0
    /// <summary>
    /// 处理View消息
    /// </summary>
    /// <param name="message"></param>
    public override void OnMessage(Message message)
    {
        string name = message.Name;

        object[] body = message.Params;
        switch (name)
        {
        case MessageConst.CMD_REFRESHGOLDMALLITEM:
            PopupManager.ShowConfirmWindow(I18NManager.Get("Shop_NeedToRefresh")).WindowActionCallback = evt =>
            {
                if (evt == WindowEvent.Ok)
                {
                    RefreshGoldMallClick();
                }
            };

            break;

        case MessageConst.CMD_REGETSHOPRULE:
            GetUserInfo();
            break;

        case MessageConst.CMD_USETASTECARD:
            //要先用复选框!
            var tasteNum = GlobalData.PropModel.GetUserProp(PropConst.TasteCardId).Num;

            if (tasteNum == 0)
            {
                FlowText.ShowMessage(I18NManager.Get("Shop_NoVipTaste"));
                return;
            }


            PopupManager.ShowConfirmWindow(I18NManager.Get("Shop_UseTasteCard", tasteNum, tasteNum)).WindowActionCallback = evt =>
            {
                if (evt == WindowEvent.Ok)
                {
                    UseTasteCard();
                }
            };

            break;

        case MessageConst.CMD_BUYMONTHCARD:
            SdkHelper.PayAgent.PayMonthCard();
            break;

        case MessageConst.CMD_MALL_DAILYGEMREWARD:
            GetMonthCardReward();
            break;

        case MessageConst.CMD_MAIN_SHOW_BUY_POWER:                               //买体力
            var _buyPowerUpperlimit = GlobalData.PlayerModel.BuyPowerUpperlimit; //10
            if (GlobalData.PlayerModel.PlayerVo.PowerNum >= _buyPowerUpperlimit)
            {
                FlowText.ShowMessage(I18NManager.Get("Common_TodaysBuyUpperlimit"));                        // ("今日兑换次数已达上限");
            }
            else
            {
                ShowBuyPowerWindow();
            }
            break;

        case MessageConst.CMD_MAIN_SHOW_BUY_GOLD:                              //买金币
            var _buyGlodUpperlimit = GlobalData.PlayerModel.BuyGoldUpperlimit; //10
            if (GlobalData.PlayerModel.PlayerVo.GoldNum >= _buyGlodUpperlimit)
            {
                FlowText.ShowMessage(I18NManager.Get("Common_TodaysBuyUpperlimit"));
                return;
            }
            else
            {
                ShowBuyGlodWindow();
            }
            break;
        }
    }
Exemplo n.º 30
0
 void Awake()
 {
     if (instance == null) {
         instance = this;
     }
 }
Exemplo n.º 31
0
	// Use this for initialization
	void Awake () {
	  Instance = this;
	  HideDimNoAnimation();
	}
Exemplo n.º 32
0
 void Awake()
 {
     instance = this;
 }
Exemplo n.º 33
0
 private void initialize()
 {
     uiCamera = UICamera.createNewInstance();
     popupManager = PopupManager.createNewInstance(gameObject);
     eventSystem = CanvasEventSystem.createNewInstance();
 }
Exemplo n.º 34
0
 // Use this for initialization
 void Awake()
 {
     Instance = this;
     HideDimNoAnimation();
 }
Exemplo n.º 35
0
		public override void OnApplyTemplate()
		{
			base.OnApplyTemplate();
			PART_directoryup = GetTemplateChild<Button>(nameof(PART_directoryup));
			PART_home = GetTemplateChild<Button>(nameof(PART_home));
			PART_favorites = GetTemplateChild<Button>(nameof(PART_favorites));
			PART_refresh = GetTemplateChild<Button>(nameof(PART_refresh));
			PART_selectdisk = GetTemplateChild<Button>(nameof(PART_selectdisk));
			PART_popupmanager = GetTemplateChild<PopupManager>(nameof(PART_popupmanager));
			PART_favoritetoggle = GetTemplateChild<ToggleButton>(nameof(PART_favoritetoggle));
			PART_directoryup.Click += directoryUp;
			PART_home.Click += homeClicked;
			PART_favorites.Click += favoritesClicked;
			PART_refresh.Click += refreshClicked;
			PART_selectdisk.Click += selectdiskClicked;
			PART_favoritetoggle.Checked += addToFavorites;
			PART_favoritetoggle.Unchecked += removeFromFavorites;
		}
Exemplo n.º 36
0
    private void Awake()
    {
        rightDownload = transform.Find("RightTop").gameObject;
        transform.Find("FunctionBar/Sms/Label").GetComponent <Text>().color = ColorUtil.HexToColor("DA7DED");
        transform.Find("FunctionBar/Sms").GetComponent <Toggle>().onValueChanged.AddListener(delegate(bool b)
        {
            transform.Find("FunctionBar/Sms/Label").GetComponent <Text>().color =
                b ? ColorUtil.HexToColor("DA7DED") : ColorUtil.HexToColor("808080");
            if (b)
            {
                SendMessage(new Message(MessageConst.CMD_PHONE_SHOW_SMS));
                SendMessage(new Message(MessageConst.CMD_PHONE_HIDE_BG_REDPOINT, PhoneModeType.Sms));
                CheckIsShowDownload();
            }
        });

        transform.Find("FunctionBar/Telephone").GetComponent <Toggle>().onValueChanged.AddListener(delegate(bool b)
        {
            transform.Find("FunctionBar/Telephone/Label").GetComponent <Text>().color =
                b ? ColorUtil.HexToColor("DA7DED") : ColorUtil.HexToColor("808080");
            if (b)
            {
                SendMessage(new Message(MessageConst.CMD_PHONE_SHOW_TELE));
                SendMessage(new Message(MessageConst.CMD_PHONE_HIDE_BG_REDPOINT, PhoneModeType.Call));
                CacheVo vo = CacheManager.CheckPhoneCache();
                CheckIsShowDownload();
            }
        });

        transform.Find("FunctionBar/Friends").GetComponent <Toggle>().onValueChanged.AddListener(delegate(bool b)
        {
            transform.Find("FunctionBar/Friends/Label").GetComponent <Text>().color =
                b ? ColorUtil.HexToColor("DA7DED") : ColorUtil.HexToColor("808080");

            if (b)
            {
                SendMessage(new Message(MessageConst.CMD_PHONE_SHOW_FRIENDS));
                SendMessage(new Message(MessageConst.CMD_PHONE_HIDE_BG_REDPOINT, PhoneModeType.Friend));
                rightDownload.Hide();
            }
        });

        transform.Find("FunctionBar/Weibo").GetComponent <Toggle>().onValueChanged.AddListener(delegate(bool b)
        {
            transform.Find("FunctionBar/Weibo/Label").GetComponent <Text>().color =
                b ? ColorUtil.HexToColor("DA7DED") : ColorUtil.HexToColor("808080");
            if (b)
            {
                SendMessage(new Message(MessageConst.CMD_PHONE_SHOW_WEIBO));
                SendMessage(new Message(MessageConst.CMD_PHONE_HIDE_BG_REDPOINT, PhoneModeType.Weibo));
                rightDownload.Hide();
            }
        });

        transform.Find("RightTop/Download").GetButton().onClick.AddListener(() => {
            PopupManager.ShowWindow <PhoneDownloadTipsWindow>("Prefabs/PhoneDownloadTipsWindow").WindowActionCallback = evt =>
            {
                CheckIsShowDownload();
            };
        });
    }
Exemplo n.º 37
0
 /// <summary>
 ///  打开音游任务窗口
 /// </summary>
 private void OpenTaskWindow()
 {
     _taskWindow = PopupManager.ShowWindow <ActivityMusicTaskWindow>("ActivityMusicTemplate/Prefabs/ActivityMusicTaskWindow");
     _taskWindow.SetData(_activityMissionModel.MusicUserMissionInfo);
 }
Exemplo n.º 38
0
 /// <summary>
 /// gets the serialized object and saves it
 /// </summary>
 private void OnEnable()
 {
     Manager = (PopupManager)serializedObject.targetObject;
 }
Exemplo n.º 39
0
 void Awake()
 {
     instance = this;
 }
Exemplo n.º 40
0
 private void CloseCallback()
 {
     MusicManager.PlaySound(SoundsNames.MenuButtonClick);
     PopupManager.HidePopup(PopupName);
 }
Exemplo n.º 41
0
	private float originalCameraSize; //used for animating
	
	#endregion
	
	#region Init
	
	public void Initialize()
	{
		myPopup = this as IPopup;
		
		//parse out the clone name
		string newName = gameObject.name;
		gameObject.name = StringExtensions.ParseOutClone(ref newName);
		
		background.Start(); //resize it before we call preinit so we know we have correct size
		
		myPopup.PreInit();
		
		myCam = GetComponent(typeof(Camera)) as Camera;
		originalCameraSize = myCam.orthographicSize;
		
		//pause game
		if (shouldPauseGame == true)
			Time.timeScale = 0.0f;
		
		if (openSound != null)
			SoundManager.PlaySoundOnce(openSound);
		
		if (cancelButton != null)
		{
			cancelButton.ResizeAndReposition(cancelButton);cancelButton.Start();
			
			if (cancelButton.spriteText != null)
			{
				cancelButton.spriteText.multiline = false;
				cancelButton.spriteText.maxWidth = cancelButton.width - (cancelButton.width * GameValues.buttonTextPaddingPercentage);
			}
		}
		
		if (shouldAnimate)
			myCam.orthographicSize *= 5;
		
		popupManager = PopupManager.I;
		
		if (popupManager == null)
		{
			Kill();
			return;
		}
		
		uiManager = UIManager.instance;

		if (uiManager != null)
		{
			//save all old cameras then delete from UIManager. Otherwise objects behind will still detect input
			originalCameraSettings = uiManager.uiCameras;
			
			for (int x = uiManager.uiCameras.Length -1; x >= 0; x--)
			{
				uiManager.RemoveCamera(x);
			}
			
			uiManager.AddCamera(myCam, myCam.cullingMask, Mathf.Infinity, 0);
			
			originalRayCam = uiManager.rayCamera;
			uiManager.rayCamera = myCam;
		}
		else
		{
			Kill();
			return;
		}
		
		popupManager.activePopups.Add(myPopup);
        myCam.depth = popupManager.activePopups.Count + 1;

		if (shouldAnimate)
		{
			//called right before animation
			myPopup.PreAnimate();
			
			HOTween.defUpdateType = UpdateType.TimeScaleIndependentUpdate;
			
			Sequence s = new Sequence();
			//s.Append(HOTween.To(myCam, 1.2f, "orthographicSize", originalCameraSize));
			s.Append(HOTween.To(myCam, 0.3f, new TweenParms()
										.UpdateType(UpdateType.TimeScaleIndependentUpdate)
										.Prop("orthographicSize", originalCameraSize)
										.Ease(EaseType.EaseInBounce)
										));
			s.ApplyCallback(CallbackType.OnComplete, AnimationComplete);
			s.Play();
		}
		else
		{
			AddCancelButtonDelegate();
			myPopup.InitComplete();
		}
	}