Ejemplo n.º 1
0
    // Запускаем таймер ожидание следующей Ревардед рекламы
    private void OnAdsRewardedShowing(OnAdsRewardedShowing e)
    {
        _rewardDate          = UnbiasedTime.Instance.Now();
        _rewardDate          = _rewardDate.AddMinutes(2);
        _isRewardedWaitTimer = true;
        GlobalEvents <OnAdsRewardedWaitTimer> .Call(new OnAdsRewardedWaitTimer { IsWait = true });

        //Обнуляем Video таймер и коунтер
        StartWaitingVideo();
    }
Ejemplo n.º 2
0
        public async Task RemoveSongRequest(SongRequestItem song)
        {
            await SongRequestService.songRequestLock.WaitAndRelease(() =>
            {
                this.allRequests.Remove(song);
                return(Task.FromResult(0));
            });

            GlobalEvents.SongRequestsChangedOccurred();
        }
Ejemplo n.º 3
0
    public void OnClickReviveButton()
    {
#if UNITY_EDITOR
        GameEvents.Send(OnRevive);
#else
        GlobalEvents <OnAdsRewardedShow> .Call(new OnAdsRewardedShow());
#endif

        Destroy(gameObject);
    }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 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);
    }
Ejemplo n.º 7
0
    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);
    }
Ejemplo n.º 8
0
 public void Execute(object?parameter)
 {
     try
     {
         _execute(parameter);
     }catch (Exception ex)
     {
         GlobalEvents.raiseErrorEvent(ex);
     }
 }
Ejemplo n.º 9
0
        public async Task MoveDown(SongRequestModel song)
        {
            await SongRequestService.songRequestLock.WaitAndRelease(() =>
            {
                this.RequestSongs.MoveDown(song);
                return(Task.FromResult(0));
            });

            GlobalEvents.SongRequestsChangedOccurred();
        }
Ejemplo n.º 10
0
    // 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;
        }
    }
Ejemplo n.º 11
0
    private void BuySkin(int id)
    {
        Analytics.CustomEvent("SkinsSkinBuy",
                              new Dictionary <string, object> {
            { "sessions", PrefsManager.GameplayCounter }, { "id", id }
        });
//        OpenSkin(id);

        GlobalEvents <OnGotNewCharacter> .Call(new OnGotNewCharacter());
    }
Ejemplo n.º 12
0
    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);
    }
Ejemplo n.º 13
0
        public async Task ClearAll()
        {
            await SongRequestService.songRequestLock.WaitAndRelease(() =>
            {
                this.RequestSongs.Clear();
                return(Task.FromResult(0));
            });

            GlobalEvents.SongRequestsChangedOccurred();
        }
Ejemplo n.º 14
0
 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);
     }
 }
Ejemplo n.º 15
0
    public void AssignSkill(SkillBase newSkill)
    {
        skill = Instantiate(newSkill);
        skill.OnAssigned(ship);

        if (ship.isPlayer)
        {
            GlobalEvents.PlayerSkillChanged(skill);
        }
    }
Ejemplo n.º 16
0
        public async Task RefreshVolume()
        {
            await SongRequestService.songRequestLock.WaitAndRelease(async() =>
            {
                await this.RefreshVolumeInternal();
                this.forceStateQuery = true;
            });

            GlobalEvents.SongRequestsChangedOccurred();
        }
Ejemplo n.º 17
0
        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));
            }
        }
Ejemplo n.º 18
0
        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));
            }
        }
Ejemplo n.º 19
0
        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;
            }
        }
Ejemplo n.º 20
0
 public void ChangeSheet(int index)
 {
     try
     {
         ObjWorkSheet = (Exc.Worksheet)ObjWorkBook.Sheets[index];
     }
     catch (Exception ex)
     {
         GlobalEvents.ExeptionFounded(ex);
     }
 }
Ejemplo n.º 21
0
 public void SelectByText(string text)
 {
     try
     {
         _element.SelectByText(text);
     }
     catch (Exception ex)
     {
         GlobalEvents.ExeptionFounded(ex);
     }
 }
Ejemplo n.º 22
0
        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();
            }
        }
Ejemplo n.º 23
0
    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);
    }
Ejemplo n.º 24
0
    // Открыть скин за просмотр рекламы
    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());
    }
Ejemplo n.º 25
0
    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();
    }
Ejemplo n.º 26
0
 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();
 }
Ejemplo n.º 27
0
    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());
    }
Ejemplo n.º 28
0
 public void SelectByIndex(int index)
 {
     try
     {
         _element.SelectByIndex(index);
     }
     catch (Exception ex)
     {
         GlobalEvents.ExeptionFounded(ex);
     }
 }
Ejemplo n.º 29
0
        /// <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;
        }
Ejemplo n.º 30
0
 public static void AssertDialog()
 {
     try
     {
         _webDriver.SwitchTo().Alert().Accept();
     }
     catch (Exception ex)
     {
         GlobalEvents.ExeptionFounded(ex);
     }
 }