// Запускаем таймер ожидание следующей Ревардед рекламы private void OnAdsRewardedShowing(OnAdsRewardedShowing e) { _rewardDate = UnbiasedTime.Instance.Now(); _rewardDate = _rewardDate.AddMinutes(2); _isRewardedWaitTimer = true; GlobalEvents <OnAdsRewardedWaitTimer> .Call(new OnAdsRewardedWaitTimer { IsWait = true }); //Обнуляем Video таймер и коунтер StartWaitingVideo(); }
public async Task RemoveSongRequest(SongRequestItem song) { await SongRequestService.songRequestLock.WaitAndRelease(() => { this.allRequests.Remove(song); return(Task.FromResult(0)); }); GlobalEvents.SongRequestsChangedOccurred(); }
public void OnClickReviveButton() { #if UNITY_EDITOR GameEvents.Send(OnRevive); #else GlobalEvents <OnAdsRewardedShow> .Call(new OnAdsRewardedShow()); #endif Destroy(gameObject); }
private async Task ProcessClip(ClipModel clip) { if (this.ShowClipInfoInChat) { await ChannelSession.Services.Chat.SendMessage("Clip Created: " + clip.url); } this.extraSpecialIdentifiers[ClipURLSpecialIdentifier] = clip.url; GlobalEvents.TwitchClipCreated(clip); }
public async Task SelectFirst() { if (this.queue.Count > 0) { UserViewModel user = this.queue.ElementAt(0); this.queue.Remove(user); await ChannelSession.Settings.GameQueueUserSelectedCommand.Perform(user); } GlobalEvents.GameQueueUpdated(); }
void Purchase() { var billToBuy = tradeGoodsToBuy; inventory.GainTradeGood(myTown, billToBuy, CalculateTradeGoodPrice()); inventory.Gold -= CalculateCurrentTotalCost(); tradeGoodsAvailable.Spend(billToBuy); GlobalEvents.GoodsPurchasedEvent(billToBuy, myTown); }
public override void Execute() { //look upon me and despair Actor a = new GameObject("player actor", typeof(Actor)).GetComponent <Actor>(); a.Initialize(Resources.Load <ActorTemplate>("ActorTemplates/player").Instantiate(), 0); a.SetPosition(_position ?? Grid.GetRandom(TileStatus.Vacant)); GlobalEvents.Raise(GlobalEvent.ActorAdded, a); }
public void Execute(object?parameter) { try { _execute(parameter); }catch (Exception ex) { GlobalEvents.raiseErrorEvent(ex); } }
public async Task MoveDown(SongRequestModel song) { await SongRequestService.songRequestLock.WaitAndRelease(() => { this.RequestSongs.MoveDown(song); return(Task.FromResult(0)); }); GlobalEvents.SongRequestsChangedOccurred(); }
// Start is called before the first frame update void Start() { transform.position = GameObject.Find("Player").transform.position; Vector3 entry = GlobalEvents.GetEntry(SceneManager.GetActiveScene().name); if (!entry.Equals(new Vector3(0, 0, 0))) { transform.position = entry; } }
private void BuySkin(int id) { Analytics.CustomEvent("SkinsSkinBuy", new Dictionary <string, object> { { "sessions", PrefsManager.GameplayCounter }, { "id", id } }); // OpenSkin(id); GlobalEvents <OnGotNewCharacter> .Call(new OnGotNewCharacter()); }
public override void Execute() { NPActor a = new GameObject("", typeof(NPActor)).GetComponent <NPActor>(); a.Initialize(_template.Instantiate(), 1); a.gameObject.name = a.data.name; a.SetPosition(_position ?? Grid.GetRandom(TileStatus.Vacant)); GlobalEvents.Raise(GlobalEvent.ActorAdded, a); }
public async Task ClearAll() { await SongRequestService.songRequestLock.WaitAndRelease(() => { this.RequestSongs.Clear(); return(Task.FromResult(0)); }); GlobalEvents.SongRequestsChangedOccurred(); }
private void OnTriggerEnter2D(Collider2D collision) { Debug.Log("CHECK"); if (collision.gameObject.tag == "Player") { GlobalEvents.ItemCollected(this, new ItemCollectedEventArgs(item)); GlobalGameManager.player.ItemCollected(item); Destroy(gameObject); } }
public void AssignSkill(SkillBase newSkill) { skill = Instantiate(newSkill); skill.OnAssigned(ship); if (ship.isPlayer) { GlobalEvents.PlayerSkillChanged(skill); } }
public async Task RefreshVolume() { await SongRequestService.songRequestLock.WaitAndRelease(async() => { await this.RefreshVolumeInternal(); this.forceStateQuery = true; }); GlobalEvents.SongRequestsChangedOccurred(); }
private async void PubSub_OnSubscribedReceived(object sender, PubSubSubscriptionsEventModel packet) { UserViewModel user = ChannelSession.Services.User.GetUserByTwitchID(packet.user_id); if (user == null) { user = new UserViewModel(packet); } if (packet.IsSubscription || packet.cumulative_months == 1) { await this.AddSub(new TwitchSubEventModel(user, packet)); } else { int months = Math.Max(packet.streak_months, packet.cumulative_months); string planTier = TwitchEventService.GetSubTierNameFromText(packet.sub_plan); EventTrigger trigger = new EventTrigger(EventTypeEnum.TwitchChannelResubscribed, user); if (ChannelSession.Services.Events.CanPerformEvent(trigger)) { trigger.SpecialIdentifiers["message"] = (packet.sub_message.ContainsKey("message")) ? packet.sub_message["message"].ToString() : string.Empty; trigger.SpecialIdentifiers["usersubmonths"] = months.ToString(); trigger.SpecialIdentifiers["usersubplanname"] = !string.IsNullOrEmpty(packet.sub_plan_name) ? packet.sub_plan_name : TwitchEventService.GetSubTierNameFromText(packet.sub_plan); trigger.SpecialIdentifiers["usersubplan"] = planTier; trigger.SpecialIdentifiers["usersubstreak"] = packet.streak_months.ToString(); ChannelSession.Settings.LatestSpecialIdentifiersData[SpecialIdentifierStringBuilder.LatestSubscriberUserData] = user.ID; ChannelSession.Settings.LatestSpecialIdentifiersData[SpecialIdentifierStringBuilder.LatestSubscriberSubMonthsData] = months; user.Data.TwitchSubscribeDate = DateTimeOffset.Now.SubtractMonths(months - 1); user.Data.TwitchSubscriberTier = TwitchEventService.GetSubTierNumberFromText(packet.sub_plan); user.Data.TotalMonthsSubbed++; foreach (CurrencyModel currency in ChannelSession.Settings.Currency.Values) { currency.AddAmount(user.Data, currency.OnSubscribeBonus); } foreach (StreamPassModel streamPass in ChannelSession.Settings.StreamPass.Values) { if (trigger.User.HasPermissionsTo(streamPass.Permission)) { streamPass.AddAmount(user.Data, streamPass.SubscribeBonus); } } await ChannelSession.Services.Events.PerformEvent(trigger); } GlobalEvents.ResubscribeOccurred(new Tuple <UserViewModel, int>(user, months)); await ChannelSession.Services.Alerts.AddAlert(new AlertChatMessageViewModel(StreamingPlatformTypeEnum.Twitch, user, string.Format("{0} Re-Subscribed For {1} Months at {2}", user.Username, months, planTier), ChannelSession.Settings.AlertSubColor)); } }
public async Task AddSub(TwitchSubEventModel subEvent) { EventTrigger trigger = new EventTrigger(EventTypeEnum.TwitchChannelSubscribed, subEvent.User); if (subEvent.IsGiftedUpgrade) { var subscription = await ChannelSession.TwitchUserConnection.CheckIfSubscribedV5(ChannelSession.TwitchChannelV5, subEvent.User.GetTwitchV5APIUserModel()); if (subscription != null && !string.IsNullOrEmpty(subscription.created_at)) { subEvent.PlanTier = TwitchEventService.GetSubTierNameFromText(subscription.sub_plan); subEvent.PlanName = subscription.sub_plan_name; } } if (ChannelSession.Services.Events.CanPerformEvent(trigger)) { trigger.SpecialIdentifiers["message"] = subEvent.Message; trigger.SpecialIdentifiers["usersubplanname"] = subEvent.PlanName; trigger.SpecialIdentifiers["usersubplan"] = subEvent.PlanTier; ChannelSession.Settings.LatestSpecialIdentifiersData[SpecialIdentifierStringBuilder.LatestSubscriberUserData] = subEvent.User.ID; ChannelSession.Settings.LatestSpecialIdentifiersData[SpecialIdentifierStringBuilder.LatestSubscriberSubMonthsData] = 1; subEvent.User.SubscribeDate = DateTimeOffset.Now; subEvent.User.Data.TwitchSubscriberTier = subEvent.PlanTierNumber; subEvent.User.Data.TotalMonthsSubbed++; foreach (CurrencyModel currency in ChannelSession.Settings.Currency.Values) { currency.AddAmount(subEvent.User.Data, currency.OnSubscribeBonus); } foreach (StreamPassModel streamPass in ChannelSession.Settings.StreamPass.Values) { if (trigger.User.HasPermissionsTo(streamPass.Permission)) { streamPass.AddAmount(subEvent.User.Data, streamPass.SubscribeBonus); } } await ChannelSession.Services.Events.PerformEvent(trigger); } GlobalEvents.SubscribeOccurred(subEvent.User); if (subEvent.IsGiftedUpgrade) { await ChannelSession.Services.Alerts.AddAlert(new AlertChatMessageViewModel(StreamingPlatformTypeEnum.Twitch, subEvent.User, string.Format("{0} Continued Their Gifted Sub at {1}", subEvent.User.DisplayName, subEvent.PlanTier), ChannelSession.Settings.AlertSubColor)); } else { await ChannelSession.Services.Alerts.AddAlert(new AlertChatMessageViewModel(StreamingPlatformTypeEnum.Twitch, subEvent.User, string.Format("{0} Subscribed at {1}", subEvent.User.DisplayName, subEvent.PlanTier), ChannelSession.Settings.AlertSubColor)); } }
private async void UserClient_OnUserNoticeReceived(object sender, ChatUserNoticePacketModel userNotice) { try { if (RaidUserNoticeMessageTypeID.Equals(userNotice.MessageTypeID)) { UserViewModel user = ChannelSession.Services.User.GetUserByTwitchID(userNotice.UserID.ToString()); if (user == null) { user = new UserViewModel(userNotice); } user.SetTwitchChatDetails(userNotice); EventTrigger trigger = new EventTrigger(EventTypeEnum.TwitchChannelRaided, user); if (ChannelSession.Services.Events.CanPerformEvent(trigger)) { ChannelSession.Settings.LatestSpecialIdentifiersData[SpecialIdentifierStringBuilder.LatestRaidUserData] = user.ID; ChannelSession.Settings.LatestSpecialIdentifiersData[SpecialIdentifierStringBuilder.LatestRaidViewerCountData] = userNotice.RaidViewerCount; foreach (CurrencyModel currency in ChannelSession.Settings.Currency.Values.ToList()) { currency.AddAmount(user.Data, currency.OnHostBonus); } GlobalEvents.RaidOccurred(user, userNotice.RaidViewerCount); trigger.SpecialIdentifiers["hostviewercount"] = userNotice.RaidViewerCount.ToString(); trigger.SpecialIdentifiers["raidviewercount"] = userNotice.RaidViewerCount.ToString(); await ChannelSession.Services.Events.PerformEvent(trigger); await ChannelSession.Services.Alerts.AddAlert(new AlertChatMessageViewModel(StreamingPlatformTypeEnum.Twitch, user, string.Format("{0} raided with {1} viewers", user.Username, userNotice.RaidViewerCount), ChannelSession.Settings.AlertRaidColor)); } } else if (SubMysteryGiftUserNoticeMessageTypeID.Equals(userNotice.MessageTypeID) && userNotice.SubTotalGifted > 0) { if (ChannelSession.Services.Events.TwitchEventService != null) { await ChannelSession.Services.Events.TwitchEventService.AddMassGiftedSub(new TwitchMassGiftedSubEventModel(userNotice)); } } else if (SubGiftPaidUpgradeUserNoticeMessageTypeID.Equals(userNotice.MessageTypeID)) { if (ChannelSession.Services.Events.TwitchEventService != null) { await ChannelSession.Services.Events.TwitchEventService.AddSub(new TwitchSubEventModel(userNotice)); } } } catch (Exception ex) { Logger.ForceLog(LogLevel.Debug, JSONSerializerHelper.SerializeToString(userNotice)); Logger.Log(ex); throw ex; } }
public void ChangeSheet(int index) { try { ObjWorkSheet = (Exc.Worksheet)ObjWorkBook.Sheets[index]; } catch (Exception ex) { GlobalEvents.ExeptionFounded(ex); } }
public void SelectByText(string text) { try { _element.SelectByText(text); } catch (Exception ex) { GlobalEvents.ExeptionFounded(ex); } }
public async Task SelectFirst() { if (this.queue.Count > 0) { UserViewModel user = this.queue.ElementAt(0); this.queue.Remove(user); await ChannelSession.Services.Command.Queue(ChannelSession.Settings.GameQueueUserSelectedCommandID, new CommandParametersModel(user)); GlobalEvents.GameQueueUpdated(); } }
void Start() { var assembly = GetType().Assembly; string modName = assembly.GetName().Name; string dir = System.IO.Path.GetDirectoryName(assembly.Location); Debug.Log("Mod Init: " + modName + "(" + dir + ")"); ResourceManager.AddBundle(modName, AssetBundle.LoadFromFile(dir + "/" + modName + "_resources")); GlobalEvents.AddListener <GlobalEvents.GameStart>(GameLoaded); GlobalEvents.AddListener <GlobalEvents.LevelLoaded>(LevelLoaded); }
// Открыть скин за просмотр рекламы private void OnBuySkinByRewarded(OnBuySkinByRewarded obj) { // switch (obj.Id) // { // case CHARACTER_REWARDED_1: OpenSkin(CHARACTER_REWARDED_1); // break; // } // MasterAudio.PlaySoundAndForget("GUI_Grab"); Hide(); GlobalEvents <OnShowMenu> .Call(new OnShowMenu()); }
void LevelUpEconomy() { tradeXP -= GetEconXPForLevel(); economicLevel++; eventLog.AddTextEvent("Economy increased to level " + economicLevel, "This increases the number of trade goods\nthat can be bought and sold here."); goodsForSale.Max = MaxGoodsForEconomicLevel(economicLevel); GlobalEvents.TownEconomyLeveldUpEvent(town); OnLevelChanged(); }
public async Task SelectRandom() { if (this.queue.Count > 0) { int index = RandomHelper.GenerateRandomNumber(this.queue.Count()); UserViewModel user = this.queue.ElementAt(index); this.queue.Remove(user); await ChannelSession.Settings.GameQueueUserSelectedCommand.Perform(user); } GlobalEvents.GameQueueUpdated(); }
public Tile(int x, int z, int i) { this.x = x; this.z = z; this.index = i; this.status = TileStatus.Occupied; this.position = new Vector3(x, 0, z); GlobalEvents.Subscribe(GlobalEvent.NewTurn, (object[] args) => TickEffects()); }
public void SelectByIndex(int index) { try { _element.SelectByIndex(index); } catch (Exception ex) { GlobalEvents.ExeptionFounded(ex); } }
/// <summary> /// Unload the plugin catalog. /// Warning: all assemblies created at Load are not destroyed, so limit the usage of this function. /// </summary> public void Unload() { if (Simulators == null) { return; } foreach (var sim in Simulators) { try { sim.Deinitialize(); } catch (Exception ex) { GlobalEvents.Fire( new DebugWarning( "Unloading simulator plugin '" + sim.Name + "' (assembly " + ex.Source + ") failed; exception was thrown during deinitialize()", ex), false); } } foreach (var widget in Widgets) { try { widget.Deinitialize(); } catch (Exception ex) { GlobalEvents.Fire( new DebugWarning( "Unloading widget plugin '" + widget.Name + "' (assembly " + ex.Source + ") failed; exception was thrown during deinitialize()", ex), false); } } foreach (var ext in Extensions) { try { ext.Deinitialize(); } catch (Exception ex) { GlobalEvents.Fire( new DebugWarning( "Unloading extension plugin '" + ext.Name + "' (assembly " + ex.Source + ") failed; exception was thrown during deinitialize()", ex), false); } } Simulators = null; Widgets = null; Extensions = null; }
public static void AssertDialog() { try { _webDriver.SwitchTo().Alert().Accept(); } catch (Exception ex) { GlobalEvents.ExeptionFounded(ex); } }