예제 #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();
    }
예제 #2
0
        public async Task RemoveSongRequest(SongRequestItem song)
        {
            await SongRequestService.songRequestLock.WaitAndRelease(() =>
            {
                this.allRequests.Remove(song);
                return(Task.FromResult(0));
            });

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

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

            GlobalEvents.SongRequestsChangedOccurred();
        }
예제 #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;
        }
    }
예제 #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());
    }
예제 #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);
    }
예제 #13
0
        public async Task ClearAll()
        {
            await SongRequestService.songRequestLock.WaitAndRelease(() =>
            {
                this.RequestSongs.Clear();
                return(Task.FromResult(0));
            });

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

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

            GlobalEvents.SongRequestsChangedOccurred();
        }
예제 #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));
            }
        }
예제 #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));
            }
        }
예제 #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;
            }
        }
예제 #20
0
파일: ExcelWorker.cs 프로젝트: magnus80/at
 public void ChangeSheet(int index)
 {
     try
     {
         ObjWorkSheet = (Exc.Worksheet)ObjWorkBook.Sheets[index];
     }
     catch (Exception ex)
     {
         GlobalEvents.ExeptionFounded(ex);
     }
 }
예제 #21
0
 public void SelectByText(string text)
 {
     try
     {
         _element.SelectByText(text);
     }
     catch (Exception ex)
     {
         GlobalEvents.ExeptionFounded(ex);
     }
 }
예제 #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();
            }
        }
예제 #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);
    }
예제 #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());
    }
예제 #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();
    }
예제 #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();
 }
예제 #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());
    }
예제 #28
0
 public void SelectByIndex(int index)
 {
     try
     {
         _element.SelectByIndex(index);
     }
     catch (Exception ex)
     {
         GlobalEvents.ExeptionFounded(ex);
     }
 }
예제 #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;
        }
예제 #30
0
 public static void AssertDialog()
 {
     try
     {
         _webDriver.SwitchTo().Alert().Accept();
     }
     catch (Exception ex)
     {
         GlobalEvents.ExeptionFounded(ex);
     }
 }