示例#1
0
 void OnEnable()
 {
     EventKit.Subscribe <GameObject>("init equipped weapon", OnInitWeapon);
     EventKit.Subscribe <GameObject>("init new equipped weapon", OnInitNewWeapon);
     EventKit.Subscribe <GameObject>("change equipped weapon", OnChangeWeapon);
     EventKit.Subscribe("reposition hud elements", SetTweens);
 }
 void OnEnable()
 {
     EventKit.Subscribe <int>("init score", OnInitScore);
     EventKit.Subscribe <int>("change score", OnChangeScore);
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
     EventKit.Subscribe("reposition hud elements", PositionHUDElements);
 }
示例#3
0
 protected override void Awake()
 {
     base.Awake();
     gameObject.SetActive(false);
     EventKit.Subscribe("level loaded", OnLevelLoaded);
     EventKit.Subscribe <string>("meta reloaded", OnLevelMetaReloaded);
 }
示例#4
0
 void OnEnable()
 {
     EventKit.Subscribe <GameObject, GameObject, GameObject>("init weapons", OnInitWeapons);
     EventKit.Subscribe <GameObject>("equip new weapon", OnEquipNewWeapon);
     EventKit.Subscribe <int>("switch weapon", OnSwitchWeapon);
     EventKit.Subscribe <bool>("level loading", OnLevelLoading);
 }
示例#5
0
        private IEnumerator Start()
        {
            // Don't proceed until game chart is ready
            while (Game.Instance == null || Game.Instance.Chart == null)
            {
                yield return(null);
            }

            CanvasRect = Canvas.GetComponent <RectTransform>().rect;

            var level        = Game.Instance.Level;
            var chartSection = level.charts.Find(it => it.type == CytoidApplication.CurrentChartType);

            var path = level.BasePath + "/" +
                       (chartSection.storyboard != null ? chartSection.storyboard.path : "storyboard.json");

            if (!File.Exists(path))
            {
                enabled = false;
                yield break;
            }

            if (SceneManager.GetActiveScene().name == "Storyboard")
            {
                WatchFileUpdate();
            }

            // Listen to events
            EventKit.Subscribe <GameNote>("note clear", OnNoteClear);

            yield return(Reload(path));

            SetupGraphics();
        }
示例#6
0
 void OnEnable()
 {
     EventKit.Subscribe <GameObject>("init equipped weapon", OnInitEquippedWeapon);
     EventKit.Subscribe <GameObject>("init new equipped weapon", OnInitNewEquippedWeapon);
     EventKit.Subscribe <GameObject>("change equipped weapon", OnChangeEquippedWeapon);
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
 }
 void OnEnable()
 {
     EventKit.Subscribe <GameObject, Side>("init stashed weapon", OnInitStashedWeapon);
     EventKit.Subscribe <GameObject, Side>("change stashed weapon", OnChangeStashedWeapon);
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
     EventKit.Subscribe <float, float>("screen size changed", OnScreenSizeChanged);
 }
 void OnEnable()
 {
     EventKit.Subscribe <GameObject>("init equipped weapon", OnInitEquippedWeapon);
     EventKit.Subscribe <GameObject>("init new equipped weapon", OnInitNewEquippedWeapon);
     EventKit.Subscribe <GameObject>("change equipped weapon", OnChangeEquippedWeapon);
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
     EventKit.Subscribe("reposition hud elements", PositionHUDElements);
 }
示例#9
0
 private void Awake()
 {
     canvasGroup       = GetComponent <CanvasGroup>();
     uiElement         = GetComponent <UIElement>();
     canvasGroup.alpha = 0;
     uiElement.enabled = false;
     EventKit.Subscribe("new best", Enable);
 }
示例#10
0
 protected override void Awake()
 {
     EventKit.Subscribe("game loaded", OnGameLoaded);
     for (var i = 0; i < 10; i++)
     {
         GlobalFillColorsOverride[i] = Color.clear;
     }
 }
 void OnEnable()
 {
     EventKit.Subscribe <GameObject>("init equipped weapon", OnInitWeapon);
     EventKit.Subscribe <GameObject>("init new equipped weapon", OnInitNewWeapon);
     EventKit.Subscribe <GameObject>("change equipped weapon", OnChangeWeapon);
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
     EventKit.Subscribe <float, float>("screen size changed", OnScreenSizeChanged);
 }
示例#12
0
        protected override void Awake()
        {
            base.Awake();

            canvasGroup = GetComponent <CanvasGroup>();
            nameText    = GetComponentInChildren <Text>();
            summaryText = GetComponentInChildren <TextMeshProUGUI>();
            EventKit.Subscribe("profile update", OnProfileUpdate);

            if (!OnlinePlayer.Authenticated)
            {
                canvasGroup.alpha = 0;
            }
        }
示例#13
0
        private void Awake()
        {
            EventKit.Subscribe("reload rankings", ReloadRankings);
            Button.onClick.AddListener(OnButtonPressed);

            enabled = OnlinePlayer.Authenticated && PlayerPrefsExt.GetBool("ranked");

            if (!enabled)
            {
                RootTransform.gameObject.SetActive(false);
            }

            rootRectTransform = RootTransform.GetComponent <RectTransform>();
        }
示例#14
0
    protected override void Awake()
    {
        base.Awake();
        timeLayer = CupheadTime.Layer.Default;

        Routine.Settings.DebugMode = false;

        // 设置世界变量
        worldBlackboard.Set(VAR_AvailableExpressPackages, new List <GameObject>());
        worldBlackboard.Set(VAR_PlacedExpressPackages, new List <GameObject>());
        worldBlackboard.Set(VAR_Player, player.transform);
        worldBlackboard.Set(VAR_PlayerHand, player.GetComponentInChildren <Hand>());
        worldBlackboard.Set(VAR_ExpressPackageGenerator, expressPackageGenerator);
        worldBlackboard.Set(VAR_FillPiter, fillPit);
        worldBlackboard.Set(VAR_EscapePoint, escapePoint);

        // 监听游戏事件
        EventKit.Subscribe <GameObject> (GlobalSymbol.EVT_ExpressPackageGenerated, onExpressPackageGenerated);
        EventKit.Subscribe <GameObject> (GlobalSymbol.EVT_ExpressPackagePlaced, onExpressPackagePlaced);
        EventKit.Subscribe <GameObject> (GlobalSymbol.EVT_ExpressPackageDestroyed, onExpressPackageDestroyed);
    }
示例#15
0
 void OnEnable()
 {
     EventKit.Subscribe("wake singletons", SingletonAwake);
     EventKit.Subscribe <bool>("save player data", OnSavePlayerData);
     EventKit.Subscribe <bool>("load player data", OnLoadPlayerData);
 }
示例#16
0
 void OnEnable()
 {
     EventKit.Subscribe <int>("init hp", OnInitHP);
     EventKit.Subscribe <int>("reduce hp", OnReduceHP);
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
 }
示例#17
0
 void OnEnable()
 {
     EventKit.Subscribe <Hit>("player dead", OnPlayerDead);
 }
示例#18
0
    protected override void Awake()
    {
        base.Awake();

        CytoidApplication.SetAutoRotation(true);
        CytoidApplication.ResetResolution();

        var ringColorDef    = "#FFFFFF";
        var ringColorAltDef = "#FFFFFF";
        var fillColorDef    = "#6699CC";
        var fillColorAltDef = "#FF3C38";

        SetDefaultPref("main offset", Application.platform == RuntimePlatform.Android ? 0f : 0.1f);
        SetDefaultPref("headset offset", -0.05f);
        SetDefaultPref("show_scanner", true);
        SetDefaultPref("inverse", false);
        SetDefaultPref("ring_color", ringColorDef);
        SetDefaultPref("ring_color_alt", ringColorAltDef);
        SetDefaultPref("fill_color", fillColorDef);
        SetDefaultPref("fill_color_alt", fillColorAltDef);
        SetDefaultPref("hit_sound", "None");

        var list = HitSounds.ToList();

        list.Insert(0, new HitSound {
            Name = "None"
        });
        HitSounds = list.ToArray();
        UpdateHitSound(HitSounds[1], save: false);

        var userHitSound = PlayerPrefs.GetString("hit_sound");

        for (var index = 0; index < HitSounds.Length; index++)
        {
            if (HitSounds[index].Name == userHitSound)
            {
                UpdateHitSound(HitSounds[index]);
                HitSoundIndex = index;
            }
        }

        mainOffsetInput.text          = PlayerPrefs.GetFloat("main offset").ToString();
        headsetOffsetInput.text       = PlayerPrefs.GetFloat("headset offset").ToString();
        earlyLateIndicatorToggle.isOn = PlayerPrefsExt.GetBool("early_late_indicator");
        largerHitboxesToggle.isOn     = PlayerPrefsExt.GetBool("larger_hitboxes");

        mainOffsetInput.onEndEdit.AddListener(text =>
        {
            float offset;
            if (!float.TryParse(text, out offset))
            {
                mainOffsetInput.text = PlayerPrefs.GetFloat("main offset").ToString();
            }
            else
            {
                PlayerPrefs.SetFloat("main offset", offset);
            }
        });
        chartRelativeOffsetInput.onEndEdit.AddListener(text =>
        {
            float offset;
            if (!float.TryParse(text, out offset))
            {
                chartRelativeOffsetInput.text = ZPlayerPrefs.GetFloat(PreferenceKeys.ChartRelativeOffset(CytoidApplication.CurrentLevel.id)).ToString();
            }
            else
            {
                ZPlayerPrefs.SetFloat(PreferenceKeys.ChartRelativeOffset(CytoidApplication.CurrentLevel.id), offset);
            }
        });
        headsetOffsetInput.onEndEdit.AddListener(text =>
        {
            float offset;
            if (!float.TryParse(text, out offset))
            {
                headsetOffsetInput.text = PlayerPrefs.GetFloat("headset offset").ToString();
            }
            else
            {
                PlayerPrefs.SetFloat("headset offset", offset);
            }
        });

        usernameInput.text = PlayerPrefs.GetString(PreferenceKeys.LastUsername());
        passwordInput.text = PlayerPrefs.GetString(PreferenceKeys.LastPassword());

        if (!PlayerPrefs.HasKey("ranked"))
        {
            PlayerPrefsExt.SetBool("ranked", false);
        }

        rankStatusText.text = OnlinePlayer.Authenticated && PlayerPrefsExt.GetBool("ranked") ? "On" : "Off";

        // Initialize background
        blackout.SetActive(false);

        var backgrounds = GameObject.FindGameObjectsWithTag("Background");

        if (backgrounds.Length > 1) // Already have persisted background? (i.e. returning from Game/GameResult scene)
        {
            var localBackground = backgrounds.ToList().Find(it => it.scene == gameObject.scene);
            // Destroy local background
            Destroy(localBackground);
            // Setup the persisted background
            BackgroundCanvasHelper.SetupBackgroundCanvas(gameObject.scene);
        }
        else // Setup the local background
        {
            BackgroundCanvasHelper.SetupBackgroundCanvas(gameObject.scene);
        }

        if (OnlinePlayer.Authenticated && OnlinePlayer.AvatarTexture != null)
        {
            LoadedAvatar = true;
        }

        if (Application.platform == RuntimePlatform.Android)
        {
            headsetOffsetInput.gameObject.SetActive(false);
            LayoutRebuilder.ForceRebuildLayoutImmediate(headsetOffsetInput.transform.parent.GetComponent <RectTransform>());
        }

        EventKit.Subscribe <string>("meta reloaded", OnLevelMetaReloaded);
    }
 void OnEnable()
 {
     EventKit.Subscribe <int>("init score", OnInitScore);
     EventKit.Subscribe <int>("change score", OnChangeScore);
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
 }
示例#20
0
 void OnEnable()
 {
     EventKit.Subscribe <bool>("level completed", OnLevelCompleted);
     EventKit.Subscribe <int, Weapon.WeaponType>("player dead", OnPlayerDead);
 }
示例#21
0
 void OnEnable()
 {
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
 }
示例#22
0
 void OnEnable()
 {
     EventKit.Subscribe <int>("init lvl", OnInitInteger);
     // EventKit.Subscribe<int>("change score", OnChangeInteger);
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
 }
 void OnEnable()
 {
     EventKit.Subscribe <int>("prize collected", OnPrizeCollected);
     EventKit.Subscribe <Hit>("player dead", OnPlayerDead);
     EventKit.Subscribe <bool>("level completed", OnLevelCompleted);
 }
示例#24
0
 void OnEnable()
 {
     EventKit.Subscribe <bool>("save game data", OnSaveGameData);
     EventKit.Subscribe <bool>("load game data", OnLoadGameData);
 }
 void OnEnable()
 {
     EventKit.Subscribe <float, float>("screen size changed", OnScreenSizeChanged);
 }
示例#26
0
 void OnEnable()
 {
     EventKit.Subscribe <GameObject, Side>("init stashed weapon", OnInitStashedWeapon);
     EventKit.Subscribe <GameObject, Side>("change stashed weapon", OnChangeStashedWeapon);
 }
示例#27
0
 void OnEnable()
 {
     Start();
     EventKit.Subscribe <Hit>("player dead", OnPlayerDead);
     EventKit.Subscribe("screen size changed", OnScreenSizeChanged);
 }
示例#28
0
 void AddListeners()
 {
     EventKit.Subscribe <int, Weapon.WeaponType>("player dead", OnPlayerDead);
     EventKit.Subscribe <Collider2D>("player drowned", OnPlayerDrowned);
 }
示例#29
0
 void OnEnable()
 {
     EventKit.Subscribe <Weapon>("new equipped weapon", OnNewEquippedWeapon);
 }
 void OnEnable()
 {
     EventKit.Subscribe <bool>("fade hud", OnFadeHud);
     EventKit.Subscribe <float, float>("screen size changed", OnScreenSizeChanged);
 }