public void Initialize() { if (IsInitialized) { return; } m_Logger = new Logger(this); PurchasableItems = new Dictionary <string, ScriptDirectoryItem>(); var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); var items = ScriptRunnerManager.Instance.GetScriptRunners().Where(item => !string.IsNullOrEmpty(item.ProductIdentifier)); foreach (var item in items) { if (PurchasableItems.ContainsKey(item.ProductIdentifier)) { m_Logger.Warning(string.Format("PurchaseManager Purchasable item ({0}) already registered.", item.ProductIdentifier)); continue; } m_Logger.Verbose(string.Format("PurchaseManager Purchasable item ({0}) registered.", item.ProductIdentifier)); PurchasableItems.Add(item.ProductIdentifier, item); builder.AddProduct(item.ProductIdentifier, ProductType.NonConsumable); } UnityPurchasing.Initialize(this, builder); m_Logger.Verbose(string.Format("PurchaseManager {0} initialized.", this.GetType())); }
internal virtual void OnPlay() { m_logger.Debug("OnPlay ({0}) {1} pos={2}", Inst, Source, Position); if (AudioSource.isPlaying) { m_logger.Debug("OnPlay: already playing {0} pos={1}", Source, Position); return; } if (m_setPosition.HasValue) { AudioSource.time = m_setPosition.Value; } UpdateTime(); AudioSource.volume = m_volume; AudioSource.pitch = Pitch; AudioSource.loop = Loop; AudioSource.Play(); m_logger.Verbose("OnPlay: position now {0}", Position); DidStartPlaying = true; m_channel.AddPlayingPlayer(this); }
void PopPanel(PanelStack panelStack, Panel p, bool animate = true, RuntimeAnimatorController animController = null) { bool isTop = (p == panelStack.CurrentPanel); // Can only call PopPanel on the top panel /* rc - 11/28/2017: let panels get "popped" from * the middle of a stack. Most of the time the opposite * behaviour is unwanted (a middle panel taking anything that was * pushed after with it) * if (p != panelStack.CurrentPanel) * { * return; * }*/ AnalyticsHelper.FireEvent("PopPanel", new Dictionary <string, object> { { "Name", p.GetType().ToString() } }); m_logger.Debug("PopPanel {0} ({1}) stack={2} start", p.name, p.GetType().Name, panelStack.m_stackName); panelStack.Remove(p); m_pushedPanelStacks.Remove(p); m_showPanels.Remove(p); var curr = panelStack.CurrentPanel; var onClose = p.OnClose; p.OnClose = null; if (onClose != null) { onClose(); } if (!isTop) { // Skip animations, etc. The code // after this conditional is only // applicable when popping the top // panel SetPanelActive(p, false); p.DidPop(); return; } // If the current top panel is the one that we remembered // from before. This handles the case that "onClose" caused // the same panel to be pushed again (e.g. screen message -> // screen message) if (panelStack.CurrentPanel && (panelStack.CurrentPanel == curr)) { m_logger.Verbose("PopPanel from {0} -> {1} is ready={2}", p.GetType().Name, panelStack.CurrentPanel.GetType().Name, panelStack.CurrentPanel.IsReady); SetPanelActive(panelStack.CurrentPanel, true); panelStack.CurrentPanel.DidRegainTop(); } SetPanelOrientation(curr); // Hide this panel last // We might be re-showing the same panel as part of the onClose flow, // if so, don't tell the panel it hid because this will shut the panel down. if (panelStack.CurrentPanel != p) { Action doPop = () => { var animCtl = animController ?? p.PopAnimation; if (animCtl && animate) { p.DoAnimation(animCtl); } else { SetPanelActive(p, false); } p.DidPop(); }; if (panelStack.CurrentPanel && !panelStack.CurrentPanel.IsReady) { m_logger.Verbose("Current panel {0} is not ready!", panelStack.CurrentPanel.name); p.transform.SetAsLastSibling(); StartCoroutine(CallWhenReady(panelStack.CurrentPanel, () => { // Make sure the panel we're disabling didn't become the // current panel if (p != panelStack.CurrentPanel) { doPop(); } })); } else { m_logger.Verbose("Current panel {0} is ready!", panelStack.CurrentPanel ? panelStack.CurrentPanel.name : null); doPop(); } } if (m_showPanels.Count == 0) { ObjectHelper.SetObjectsActive(ShowWhenPanelsShowing, false); ObjectHelper.SetObjectsActive(ShowWhenNoPanelsShowing, true); } m_logger.Verbose("PopPanel {0} end", p.GetType().Name); }