Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 virtual protected void Start()
 {
     fadeCanvas      = GameObject.Find("FadeCanvas");
     fadeState       = FADE_STATE.FADEIN;
     fadeImage       = fadeCanvas.GetComponent <FadeImage>();
     fadeImage.Range = FADE_MAX;
 }
Ejemplo n.º 2
0
 void Start()
 {
     control        = GetComponent <Control> ();
     characterSound = GetComponent <CharacterSound> ();
     hurt           = GameObject.Find("Hurt").GetComponent <FadeImage> ();
     gameBGM        = GameObject.Find("Game").GetComponent <BGM> ();
 }
Ejemplo n.º 3
0
    // Use this for initialization
    private void Start()
    {
        print("start");
        buttonnowtime = 0.0f;
        startfont     = GameObject.Find("StartFont").GetComponent <StartFont>();
        menumanager   = GameObject.Find("MenuManager").GetComponent <MenuManager>();
        menuTransform = GameObject.Find("menuscreen").transform;
        pause         = GameObject.Find("PauseManager").GetComponent <PauseManager>();
        fd_out        = GameObject.Find("Panel").GetComponent <FadeImage>();
        timestop      = GameObject.Find("StageManager").transform.Find("ViewTimeMain").gameObject;
        stageMG       = GameObject.Find("StageManager").GetComponent <StageManager>();
        //値をunityの実変数からもらう
        menuPosition = menuTransform.position;
        //色を変更するゲームオブジェクトを入手
        buttoncolor = GameObject.Find("menu_button_game");
        //今の色コンソールに出力
        Debug.Log(buttoncolor.GetComponent <Renderer>().material.color);

        this.audioClip = new CustomAudioClip[(int)AudioList.AUDIO_MAX];
        this.audioClip[(int)AudioList.AUDIO_BUTTON].Clip = Resources.Load("Audio/SE/Button_Yes", typeof(AudioClip)) as AudioClip;
        this.audioClip[(int)AudioList.AUDIO_BUTTON].Vol  = 1.0f;

        this.sourceAudio         = this.gameObject.AddComponent <SourceAudio>();
        this.sourceAudio.m_Audio = this.audioClip;
    }
Ejemplo n.º 4
0
    private void Start()
    {
        InitStart();
        playerstartPos       = tf.position;
        startscale           = tf.localScale;
        nowscale             = startscale;
        startvelocity        = rb2d.velocity;
        startangularvelocity = rb2d.angularVelocity;

        stageCollider = GameObject.Find("StageBackGround").GetComponent <BoxCollider2D>();
        clipCollider  = GameObject.Find("clip_L").GetComponent <BoxCollider2D>();

        CreateTapEffect();
        tapEffectTransform.GetComponent <Renderer>().enabled = false;

        groundFilter.SetLayerMask(LayerMask.GetMask("Leaf", "Branch", "RedBranch"));    //足場になりうるレイヤー

        hitParticle    = GameObject.Find("EffectManager").GetComponent <EffectManager>().hitEffect;
        pickUpParticle = GameObject.Find("EffectManager").GetComponent <EffectManager>().acornPickUpEffect;

        fd_out = GameObject.Find("Panel").GetComponent <FadeImage>();

        this.audioClip = new CustomAudioClip[(int)AudioList.AUDIO_MAX];
        this.audioClip[(int)AudioList.AUDIO_JUMP].Clip = Resources.Load("Audio/SE/Filmushi_Jump", typeof(AudioClip)) as AudioClip;
        this.audioClip[(int)AudioList.AUDIO_JUMP].Vol  = 1.0f;
        this.audioClip[(int)AudioList.AUDIO_DEAD].Clip = Resources.Load("Audio/SE/Filmushi_Down", typeof(AudioClip)) as AudioClip;
        this.audioClip[(int)AudioList.AUDIO_DEAD].Vol  = 1.0f;

        this.soueceAudio         = this.gameObject.AddComponent <SourceAudio>();
        this.soueceAudio.m_Audio = this.audioClip;
    }
Ejemplo n.º 5
0
    void Awake()
    {
        AudioSource hurtSound = GetComponent <AudioSource> ();
        FadeImage   skull     = GameObject.Find("Skull").GetComponent <FadeImage> ();

        monster = new MonsterHP(hurtSound, hurtSound, skull);
    }
Ejemplo n.º 6
0
    // Use this for initialization
    private void Start()
    {
        nextScene = "StageSelectScene";

        mc = GameObject.Find("MainCamera");
        //tl = GameObject.Find("TitleLogo");
        pnl       = GameObject.Find("FadePanel");
        ts        = GameObject.Find("TouchStart");
        mc_script = mc.GetComponent <TranslationObject>();
        //tl_script = tl.GetComponent<TranslationObject>();
        fd_out = pnl.GetComponent <FadeImage>();

        this.audioClip         = new CustomAudioClip[(int)AudioList.AUDIO_MAX];
        this.audioClip[0].Clip = Resources.Load("Audio/BGM/BGM_Title", typeof(AudioClip)) as AudioClip;
        this.audioClip[0].Vol  = 1.0f;
        this.audioClip[1].Clip = Resources.Load("Audio/SE/Button_Yes", typeof(AudioClip)) as AudioClip;
        this.audioClip[1].Vol  = 1.0f;

        this.sourceAudio         = this.gameObject.AddComponent <SourceAudio>();
        this.sourceAudio.m_Audio = this.audioClip;

        this.sourceAudio.PlayBGM((int)AudioList.AUDIO_BGM, true);

        filmushiMaterial.SetTexture("_MainTex", filmushi_sleep);

        touchStart.SetActive(false);
    }
Ejemplo n.º 7
0
 public static void changeScene(string sceneName)
 {
     if (FadeImage.IsDuringFade)
     {
         return;
     }
     FadeImage.fadeOut(sceneName);
 }
 // Use this for initialization
 void Start()
 {
     rt           = GetComponent <RectTransform>();
     FIScript     = GetComponent <FadeImage>();
     creditsImage = GetComponent <Image>();
     firstScreenAfterCredsImage = firstScreenAfterCreds.GetComponent <Image>();
     firstScreenAfterCredsCutsceneController = firstScreenAfterCreds.GetComponent <CutsceneController>();
     moveSpeed = initial_speed;
 }
Ejemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     curScene = GetComponent <Image>();
     if (nextScene != null)
     {
         nextSceneImage = nextScene.GetComponent <Image>();
     }
     rt       = GetComponent <IntroMoveAlpaca>();
     FIScript = GetComponent <FadeImage>();
 }
Ejemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        fade   = this.GetComponent <FadeImage>();
        ARound = false;

        //設定
        round[0].color = clear;
        round[1].color = clear;
        round[2].color = clear;
    }
Ejemplo n.º 11
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            ImageBackground = Template.FindName("PART_ImageBackground", this) as FadeImage;
            if (ImageBackground != null)
            {
                BindingTools.SetBinding(ImageBackground,
                                        FadeImage.IsBlurEnabledProperty,
                                        mainModel.AppSettings,
                                        nameof(PlayniteSettings.BlurWindowBackgroundImage),
                                        mode: BindingMode.OneWay);
                BindingTools.SetBinding(ImageBackground,
                                        FadeImage.BlurAmountProperty,
                                        mainModel.AppSettings,
                                        nameof(PlayniteSettings.BackgroundImageBlurAmount),
                                        mode: BindingMode.OneWay);
                BindingTools.SetBinding(ImageBackground,
                                        FadeImage.HighQualityBlurProperty,
                                        mainModel.AppSettings,
                                        nameof(PlayniteSettings.HighQualityBackgroundBlur),
                                        mode: BindingMode.OneWay);
                BindingTools.SetBinding(ImageBackground,
                                        FadeImage.AnimationEnabledProperty,
                                        mainModel.AppSettings,
                                        nameof(PlayniteSettings.BackgroundImageAnimation),
                                        mode: BindingMode.OneWay);
            }

            ElemNoGamesNotif = Template.FindName("PART_ElemNoGamesNotif", this) as FrameworkElement;
            if (ElemNoGamesNotif != null)
            {
                BindingTools.SetBinding(ElemNoGamesNotif,
                                        Control.VisibilityProperty,
                                        mainModel,
                                        $"{nameof(mainModel.GamesView)}.{nameof(mainModel.GamesView.CollectionView)}.{nameof(mainModel.GamesView.Items.Count)}",
                                        converter: new IntToVisibilityConverter(),
                                        converterParameter: 0);
            }

            SetBackgroundBinding();
            SetBackgroundEffect();

            SetViewBinding(ref ViewDetails, "PART_ViewDetails", ViewType.Details);
            SetViewBinding(ref ViewGrid, "PART_ViewGrid", ViewType.Grid);
            SetViewBinding(ref ViewList, "PART_ViewList", ViewType.List);

            ControlTemplateTools.InitializePluginControls(
                mainModel.Extensions,
                Template,
                this,
                SDK.ApplicationMode.Desktop,
                mainModel,
                $"{nameof(DesktopAppViewModel.SelectedGameDetails)}.{nameof(GameDetailsViewModel.Game)}.{nameof(GameDetailsViewModel.Game.Game)}");
        }
Ejemplo n.º 12
0
    // Use this for initialization
    private void Start()
    {
        fd_out = GameObject.Find("Panel").GetComponent <FadeImage>();

        this.audioClip         = new CustomAudioClip[(int)AudioList.AUDIO_MAX];
        this.audioClip[0].Clip = Resources.Load("Audio/SE/Button_Yes", typeof(AudioClip)) as AudioClip;
        this.audioClip[0].Vol  = 1.0f;

        this.sourceAudio         = this.gameObject.AddComponent <SourceAudio>();
        this.sourceAudio.m_Audio = audioClip;
    }
Ejemplo n.º 13
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 14
0
 MenuConfirmationSelectState mcss; //ステージクラスの制御変数
 // Use this for initialization
 void Start()
 {
     mcss   = MenuConfirmationSelectState.NOT_SELECT;
     fd_out = GameObject.Find("Panel").GetComponent <FadeImage>();
     backgroundTransform  = GameObject.Find("black_background_Confirmation").transform;
     stageselectTransform = GameObject.Find("Copy of text_window").transform;
     backgroundPosition   = backgroundTransform.position;
     selectPosition       = stageselectTransform.position;
     menuselectflg        = false;
     rmenuselectflg       = false;
 }
Ejemplo n.º 15
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
         anim      = GetComponent <Animator>();
     }
 }
Ejemplo n.º 16
0
 private FadeImage fd_out;              //フェードアウト
 // Use this for initialization
 void Start()
 {
     mcrs   = MenuConfirmationRestartState.NOT_SELECT;
     fd_out = GameObject.Find("Panel").GetComponent <FadeImage>();
     backgroundTransform = GameObject.Find("black_background_Confirmation").transform;
     restartTransform    = GameObject.Find("Copy of text_window_stage_select").transform;
     backgroundPosition  = backgroundTransform.position;
     restartPosition     = restartTransform.position;
     menurestartflg      = false;
     rmenurestartflg     = false;
     returnscene         = SceneManager.GetActiveScene().name;
 }
Ejemplo n.º 17
0
    void Awake()
    {
        titlePanel       = GameObject.Find("TitlePanel");
        stageSelectPanel = GameObject.Find("StageSelectPanel");
        hideUIPanel      = GameObject.Find("HideUIPanel");

        fadeCanvas = GameObject.Find("FadeCanvas");
        fade       = fadeCanvas.GetComponent <Fade>();
        fI         = fadeCanvas.GetComponent <FadeImage>();

        sfx = GameObject.Find("SFX").GetComponent <SFXPlayer>();
    }
Ejemplo n.º 18
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            ImageBackground = Template.FindName("PART_ImageBackground", this) as FadeImage;
            SetBackgroundBinding();
            SetBackgroundEffect();

            SetViewBinding(ref ViewDetails, "PART_ViewDetails", ViewType.Details);
            SetViewBinding(ref ViewGrid, "PART_ViewGrid", ViewType.Grid);
            SetViewBinding(ref ViewList, "PART_ViewList", ViewType.List);
        }
Ejemplo n.º 19
0
 void Awake()
 {
     //  カメラの検索
     mainCamera = Camera.main;
     subCamera  = Camera.allCameras[0];
     //  サブカメラの非アクティブ化
     subCamera.gameObject.SetActive(false);
     //  コルーチンが複数回呼ばれないように
     isSwitchingMain = true;
     //  画面のマスク処理をしているクラスの参照
     fade         = FindObjectOfType <FadeImage>();
     fade.enabled = true;
 }
Ejemplo n.º 20
0
    // Use this for initialization
    void Start()
    {
        player1 = GameObject.FindGameObjectWithTag("P1");
        player2 = GameObject.FindGameObjectWithTag("P2");
        P1HP    = player1.GetComponent <HPDirectorScript>();
        P2HP    = player2.GetComponent <HPDirectorScript>();

        timer = ButDir.GetComponent <TimerScript>();
        fade  = this.GetComponent <FadeImage>();

        timeUp.enabled = false;
        timeUp.color   = white;
    }
Ejemplo n.º 21
0
    private void Start()
    {
        parent = this.transform.root.gameObject;
        fade   = GameObject.Find("Canvas").transform.Find("Panel").GetComponent <FadeImage>();

        this.audioClip         = new CustomAudioClip[2];
        this.audioClip[0].Clip = Resources.Load("Audio/SE/Button_Yes", typeof(AudioClip)) as AudioClip;
        this.audioClip[0].Vol  = 1.0f;
        this.audioClip[1].Clip = Resources.Load("Audio/SE/Button_No", typeof(AudioClip)) as AudioClip;
        this.audioClip[1].Vol  = 1.0f;

        this.sourceAudio         = this.gameObject.AddComponent <SourceAudio>();
        this.sourceAudio.m_Audio = this.audioClip;
    }
    private void Damage()
    {
        audioManager.Play("Damage");
        if (hurtImage == null)
        {
            return;
        }
        FadeImage fadeImage = hurtImage.GetComponent <FadeImage>();

        if (fadeImage == null)
        {
            return;
        }
        fadeImage.ResetAlpha();
    }
Ejemplo n.º 23
0
    // Use this for initialization
    void Start()
    {
        audio = this.GetComponent <AudioSource>();

        gameDirector = this.GetComponent <GameDirector>();

        timer = dirctor.GetComponent <TimerScript>();
        fade  = this.GetComponent <FadeImage>();

        timer.SwithGameTimer = false;

        //拡大しておく
        fight.transform.localScale = new Vector3(3, 3, 3);
        scale = fight.transform.localScale;

        //設定
        fight.color = clear;
    }
Ejemplo n.º 24
0
    // Use this for initialization
    void Start()
    {
        player1 = GameObject.FindGameObjectWithTag("P1");
        player2 = GameObject.FindGameObjectWithTag("P2");

        timer = ButDir.GetComponent <TimerScript>();
        fade  = this.GetComponent <FadeImage>();

        WDir  = this.GetComponent <WinnerDirector>();
        TUDir = this.GetComponent <TimeUPDirector>();

        datas = GameObject.Find("GameSystem").GetComponent <DataRetention>();

        winner.enabled = false;
        win.enabled    = false;
        draw.enabled   = false;

        winner.color = white;
        win.color    = white;
        draw.color   = white;
    }
Ejemplo n.º 25
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            ImageBackground = Template.FindName("PART_ImageBackground", this) as FadeImage;
            if (ImageBackground != null)
            {
                BindingTools.SetBinding(ImageBackground,
                                        FadeImage.IsBlurEnabledProperty,
                                        mainModel.AppSettings,
                                        nameof(PlayniteSettings.BlurWindowBackgroundImage));
                BindingTools.SetBinding(ImageBackground,
                                        FadeImage.BlurAmountProperty,
                                        mainModel.AppSettings,
                                        nameof(PlayniteSettings.BackgroundImageBlurAmount));
                BindingTools.SetBinding(ImageBackground,
                                        FadeImage.HighQualityBlurProperty,
                                        mainModel.AppSettings,
                                        nameof(PlayniteSettings.HighQualityBackgroundBlur));
            }

            ElemNoGamesNotif = Template.FindName("PART_ElemNoGamesNotif", this) as FrameworkElement;
            if (ElemNoGamesNotif != null)
            {
                BindingTools.SetBinding(ElemNoGamesNotif,
                                        Control.VisibilityProperty,
                                        mainModel,
                                        $"{nameof(mainModel.GamesView)}.{nameof(mainModel.GamesView.CollectionView)}.{nameof(mainModel.GamesView.Items.Count)}",
                                        converter: new IntToVisibilityConverter(),
                                        converterParameter: 0);
            }

            SetBackgroundBinding();
            SetBackgroundEffect();

            SetViewBinding(ref ViewDetails, "PART_ViewDetails", ViewType.Details);
            SetViewBinding(ref ViewGrid, "PART_ViewGrid", ViewType.Grid);
            SetViewBinding(ref ViewList, "PART_ViewList", ViewType.List);
        }
Ejemplo n.º 26
0
    // Use this for initialization
    void Start()
    {
        audio   = this.GetComponent <AudioSource>();
        player1 = GameObject.FindGameObjectWithTag("P1");
        player2 = GameObject.FindGameObjectWithTag("P2");
        P1HP    = player1.GetComponent <HPDirectorScript>();
        P2HP    = player2.GetComponent <HPDirectorScript>();

        fade      = this.GetComponent <FadeImage>();
        fade.Flag = false;

        for (int i = 0; i < KO.Length; i++)
        {
            PosKO[i]             = KO[i].transform.localPosition;
            PerfectKO[i].enabled = false;
            PerfectKO[i].transform.localScale = strScle;
        }

        PerfectKO[0].color = white;
        PerfectKO[1].color = white;
        KOImage[0].color   = white;
        KOImage[1].color   = white;
    }
Ejemplo n.º 27
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            ImageBackground = Template.FindName("PART_ImageBackground", this) as FadeImage;
            //if (ImageBackground != null)
            //{
            //    BindingTools.SetBinding(ImageBackground,
            //        FadeImage.IsBlurEnabledProperty,
            //        mainModel.AppSettings,
            //        nameof(PlayniteSettings.BlurWindowBackgroundImage));
            //    BindingTools.SetBinding(ImageBackground,
            //        FadeImage.BlurAmountProperty,
            //        mainModel.AppSettings,
            //        nameof(PlayniteSettings.BackgroundImageBlurAmount));
            //}

            SetBackgroundBinding();
            SetBackgroundEffect();

            SetViewBinding(ref ViewDetails, "PART_ViewDetails", ViewType.Details);
            SetViewBinding(ref ViewGrid, "PART_ViewGrid", ViewType.Grid);
            SetViewBinding(ref ViewList, "PART_ViewList", ViewType.List);
        }
Ejemplo n.º 28
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            ButtonPlayAction = Template.FindName("PART_ButtonPlayAction", this) as Button;
            if (ButtonPlayAction != null)
            {
                BindingTools.SetBinding(ButtonPlayAction,
                                        Button.CommandProperty,
                                        nameof(GameDetailsViewModel.PlayCommand));
                BindingTools.SetBinding(ButtonPlayAction,
                                        Button.ContentProperty,
                                        nameof(GameDetailsViewModel.ContextActionDescription));
                BindingTools.SetBinding(ButtonPlayAction,
                                        Button.VisibilityProperty,
                                        nameof(GameDetailsViewModel.IsPlayAvailable),
                                        converter: new BooleanToVisibilityConverter());
            }

            ButtonContextAction = Template.FindName("PART_ButtonContextAction", this) as Button;
            if (ButtonContextAction != null)
            {
                BindingTools.SetBinding(ButtonContextAction,
                                        Button.CommandProperty,
                                        nameof(GameDetailsViewModel.ContextActionCommand));
                BindingTools.SetBinding(ButtonContextAction,
                                        Button.ContentProperty,
                                        nameof(GameDetailsViewModel.ContextActionDescription));
                BindingTools.SetBinding(ButtonContextAction,
                                        Button.VisibilityProperty,
                                        nameof(GameDetailsViewModel.IsContextAvailable),
                                        converter: new BooleanToVisibilityConverter());
            }

            ButtonMoreActions = Template.FindName("PART_ButtonMoreActions", this) as Button;
            if (ButtonMoreActions != null)
            {
                LeftClickContextMenuBehavior.SetEnabled(ButtonMoreActions, true);

                if (!DesignerProperties.GetIsInDesignMode(this))
                {
                    ButtonMoreActions.ContextMenu = new GameMenu(mainModel)
                    {
                        ShowStartSection = false,
                        Placement        = PlacementMode.Bottom
                    };
                    BindingTools.SetBinding(ButtonMoreActions.ContextMenu,
                                            Button.DataContextProperty,
                                            mainModel,
                                            nameof(DesktopAppViewModel.SelectedGame));
                }
            }

            HtmlDescription = Template.FindName("PART_HtmlDescription", this) as HtmlTextView;
            if (HtmlDescription != null)
            {
                BindingTools.SetBinding(HtmlDescription,
                                        HtmlTextView.HtmlTextProperty,
                                        GetGameBindingPath(nameof(GamesCollectionViewEntry.Description)));
                BindingTools.SetBinding(HtmlDescription,
                                        HtmlTextView.VisibilityProperty,
                                        nameof(GameDetailsViewModel.DescriptionVisibility));
            }

            ImageCover = Template.FindName("PART_ImageCover", this) as Image;
            if (ImageCover != null)
            {
                BindingTools.SetBinding(ImageCover,
                                        Image.SourceProperty,
                                        GetGameBindingPath(nameof(GamesCollectionViewEntry.CoverImageObject)),
                                        converter: new NullToDependencyPropertyUnsetConverter());
                BindingTools.SetBinding(ImageCover,
                                        Image.VisibilityProperty,
                                        nameof(GameDetailsViewModel.CoverVisibility));
            }

            ImageIcon = Template.FindName("PART_ImageIcon", this) as Image;
            if (ImageIcon != null)
            {
                var sourceBinding = new PriorityBinding();
                sourceBinding.Bindings.Add(new Binding()
                {
                    Path      = new PropertyPath(GetGameBindingPath(nameof(GamesCollectionViewEntry.IconObject))),
                    Converter = new NullToDependencyPropertyUnsetConverter()
                });
                sourceBinding.Bindings.Add(new Binding()
                {
                    Path      = new PropertyPath(GetGameBindingPath(nameof(GamesCollectionViewEntry.DefaultIconObject))),
                    Converter = new NullToDependencyPropertyUnsetConverter()
                });

                BindingOperations.SetBinding(ImageIcon, Image.SourceProperty, sourceBinding);
                BindingTools.SetBinding(ImageIcon,
                                        Image.VisibilityProperty,
                                        nameof(GameDetailsViewModel.IconVisibility));
            }

            ImageBackground = Template.FindName("PART_ImageBackground", this) as FadeImage;
            if (ImageBackground != null)
            {
                SetBackgroundBinding();
                BindingTools.SetBinding(ImageBackground,
                                        Image.VisibilityProperty,
                                        nameof(GameDetailsViewModel.BackgroundVisibility));
            }

            SetElemVisibility(ref ElemPlayTime, "PART_ElemPlayTime", nameof(GameDetailsViewModel.PlayTimeVisibility));
            SetElemVisibility(ref ElemLastPlayed, "PART_ElemLastPlayed", nameof(GameDetailsViewModel.LastPlayedVisibility));
            SetElemVisibility(ref ElemCompletionStatus, "PART_ElemCompletionStatus", nameof(GameDetailsViewModel.CompletionStatusVisibility));
            SetElemVisibility(ref ElemLibrary, "PART_ElemLibrary", nameof(GameDetailsViewModel.SourceLibraryVisibility));
            SetElemVisibility(ref ElemPlatform, "PART_ElemPlatform", nameof(GameDetailsViewModel.PlatformVisibility));
            SetElemVisibility(ref ElemGenres, "PART_ElemGenres", nameof(GameDetailsViewModel.GenreVisibility));
            SetElemVisibility(ref ElemDevelopers, "PART_ElemDevelopers", nameof(GameDetailsViewModel.DeveloperVisibility));
            SetElemVisibility(ref ElemPublishers, "PART_ElemPublishers", nameof(GameDetailsViewModel.PublisherVisibility));
            SetElemVisibility(ref ElemReleaseDate, "PART_ElemReleaseDate", nameof(GameDetailsViewModel.ReleaseDateVisibility));
            SetElemVisibility(ref ElemTags, "PART_ElemCategories", nameof(GameDetailsViewModel.CategoryVisibility));
            SetElemVisibility(ref ElemCategories, "PART_ElemTags", nameof(GameDetailsViewModel.TagVisibility));
            SetElemVisibility(ref ElemLinks, "PART_ElemLinks", nameof(GameDetailsViewModel.LinkVisibility));
            SetElemVisibility(ref ElemDescription, "PART_ElemDescription", nameof(GameDetailsViewModel.DescriptionVisibility));
            SetElemVisibility(ref ElemDescription, "PART_ElemAgeRating", nameof(GameDetailsViewModel.AgeRatingVisibility));
            SetElemVisibility(ref ElemDescription, "PART_ElemSeries", nameof(GameDetailsViewModel.SeriesVisibility));
            SetElemVisibility(ref ElemDescription, "PART_ElemRegion", nameof(GameDetailsViewModel.RegionVisibility));
            SetElemVisibility(ref ElemDescription, "PART_ElemSource", nameof(GameDetailsViewModel.SourceVisibility));
            SetElemVisibility(ref ElemDescription, "PART_ElemVersion", nameof(GameDetailsViewModel.VersionVisibility));
            SetElemVisibility(ref ElemDescription, "PART_ElemCommunityScore", nameof(GameDetailsViewModel.CommunityScoreVisibility));
            SetElemVisibility(ref ElemDescription, "PART_ElemCriticScore", nameof(GameDetailsViewModel.CriticScoreVisibility));
            SetElemVisibility(ref ElemDescription, "PART_ElemUserScore", nameof(GameDetailsViewModel.UserScoreVisibility));

            SetGameItemButtonBinding(ref ButtonLibrary, "PART_ButtonLibrary",
                                     nameof(GameDetailsViewModel.SetLibraryFilterCommand),
                                     GetGameBindingPath(nameof(GamesCollectionViewEntry.PluginId)),
                                     GetGameBindingPath($"{nameof(GamesCollectionViewEntry.LibraryPlugin)}.{nameof(GamesCollectionViewEntry.LibraryPlugin.Name)}"),
                                     nameof(GameDetailsViewModel.SourceLibraryVisibility));

            SetGameItemButtonBinding(ref ButtonPlatform, "PART_ButtonPlatform",
                                     nameof(GameDetailsViewModel.SetPlatformFilterCommand),
                                     GetGameBindingPath(nameof(GamesCollectionViewEntry.Platform)),
                                     GetGameBindingPath($"{nameof(GamesCollectionViewEntry.Platform)}.{nameof(GamesCollectionViewEntry.Platform.Name)}"),
                                     nameof(GameDetailsViewModel.PlatformVisibility));

            SetGameItemButtonBinding(ref ButtonReleaseDate, "PART_ButtonReleaseDate",
                                     nameof(GameDetailsViewModel.SetReleaseDateFilterCommand),
                                     GetGameBindingPath(nameof(GamesCollectionViewEntry.ReleaseDate)),
                                     GetGameBindingPath(nameof(GamesCollectionViewEntry.ReleaseDate)),
                                     nameof(GameDetailsViewModel.ReleaseDateVisibility),
                                     new NullableDateToStringConverter());

            SetGameItemButtonBinding(ref ButtonVersion, "PART_ButtonVersion",
                                     nameof(GameDetailsViewModel.SetVersionFilterCommand),
                                     GetGameBindingPath(nameof(GamesCollectionViewEntry.Version)),
                                     GetGameBindingPath(nameof(GamesCollectionViewEntry.Version)),
                                     nameof(GameDetailsViewModel.VersionVisibility));

            SetGameItemButtonBinding(ref ButtonAgeRating, "PART_ButtonAgeRating",
                                     nameof(GameDetailsViewModel.SetAgeRatingCommand),
                                     GetGameBindingPath(nameof(GamesCollectionViewEntry.AgeRating)),
                                     GetGameBindingPath($"{nameof(GamesCollectionViewEntry.AgeRating)}.{nameof(GamesCollectionViewEntry.AgeRating.Name)}"),
                                     nameof(GameDetailsViewModel.AgeRatingVisibility));

            SetGameItemButtonBinding(ref ButtonSeries, "PART_ButtonSeries",
                                     nameof(GameDetailsViewModel.SetSeriesFilterCommand),
                                     GetGameBindingPath(nameof(GamesCollectionViewEntry.Series)),
                                     GetGameBindingPath($"{nameof(GamesCollectionViewEntry.Series)}.{nameof(GamesCollectionViewEntry.Series.Name)}"),
                                     nameof(GameDetailsViewModel.SeriesVisibility));

            SetGameItemButtonBinding(ref ButtonSource, "PART_ButtonSource",
                                     nameof(GameDetailsViewModel.SetSourceFilterCommand),
                                     GetGameBindingPath(nameof(GamesCollectionViewEntry.Source)),
                                     GetGameBindingPath($"{nameof(GamesCollectionViewEntry.Source)}.{nameof(GamesCollectionViewEntry.Source.Name)}"),
                                     nameof(GameDetailsViewModel.SourceVisibility));

            SetGameItemButtonBinding(ref ButtonRegion, "PART_ButtonRegion",
                                     nameof(GameDetailsViewModel.SetRegionFilterCommand),
                                     GetGameBindingPath(nameof(GamesCollectionViewEntry.Region)),
                                     GetGameBindingPath($"{nameof(GamesCollectionViewEntry.Region)}.{nameof(GamesCollectionViewEntry.Region.Name)}"),
                                     nameof(GameDetailsViewModel.RegionVisibility));

            SetGameItemTextBinding(ref TextPlayTime, "PART_TextPlayTime",
                                   nameof(GameDetailsViewModel.Game.Playtime),
                                   nameof(GameDetailsViewModel.PlayTimeVisibility),
                                   new LongToTimePlayedConverter());

            SetGameItemTextBinding(ref TextLastActivity, "PART_TextLastActivity",
                                   nameof(GameDetailsViewModel.Game.LastActivity),
                                   nameof(GameDetailsViewModel.LastPlayedVisibility),
                                   new DateTimeToLastPlayedConverter());

            SetGameItemTextBinding(ref TextCompletionStatus, "PART_TextCompletionStatus",
                                   nameof(GameDetailsViewModel.Game.CompletionStatus),
                                   nameof(GameDetailsViewModel.CompletionStatusVisibility),
                                   new ObjectToStringConverter());

            SetGameItemTextBinding(ref TextCommunityScore, "PART_TextCommunityScore",
                                   nameof(GameDetailsViewModel.Game.CommunityScore),
                                   nameof(GameDetailsViewModel.CommunityScoreVisibility));
            if (TextCommunityScore != null)
            {
                BindingTools.SetBinding(TextCommunityScore,
                                        TextBlock.TagProperty,
                                        GetGameBindingPath(nameof(GamesCollectionViewEntry.CommunityScoreRating)));
            }

            SetGameItemTextBinding(ref TextCriticScore, "PART_TextCriticScore",
                                   nameof(GameDetailsViewModel.Game.CriticScore),
                                   nameof(GameDetailsViewModel.CriticScoreVisibility));
            if (TextCriticScore != null)
            {
                BindingTools.SetBinding(TextCriticScore,
                                        TextBlock.TagProperty,
                                        GetGameBindingPath(nameof(GamesCollectionViewEntry.CriticScoreRating)));
            }

            SetGameItemTextBinding(ref TextUserScore, "PART_TextUserScore",
                                   nameof(GameDetailsViewModel.Game.UserScore),
                                   nameof(GameDetailsViewModel.UserScoreVisibility));
            if (TextUserScore != null)
            {
                BindingTools.SetBinding(TextUserScore,
                                        TextBlock.TagProperty,
                                        GetGameBindingPath(nameof(GamesCollectionViewEntry.UserScoreRating)));
            }

            SetItemsControlBinding(ref ItemsGenres, "PART_ItemsGenres",
                                   nameof(GameDetailsViewModel.SetGenreFilterCommand),
                                   nameof(GamesCollectionViewEntry.Genres),
                                   nameof(GameDetailsViewModel.GenreVisibility));

            SetItemsControlBinding(ref ItemsDevelopers, "PART_ItemsDevelopers",
                                   nameof(GameDetailsViewModel.SetDeveloperFilterCommand),
                                   nameof(GamesCollectionViewEntry.Developers),
                                   nameof(GameDetailsViewModel.DeveloperVisibility));

            SetItemsControlBinding(ref ItemsPublishers, "PART_ItemsPublishers",
                                   nameof(GameDetailsViewModel.SetPublisherFilterCommand),
                                   nameof(GamesCollectionViewEntry.Publishers),
                                   nameof(GameDetailsViewModel.PublisherVisibility));

            SetItemsControlBinding(ref ItemsCategories, "PART_ItemsCategories",
                                   nameof(GameDetailsViewModel.SetCategoryFilterCommand),
                                   nameof(GamesCollectionViewEntry.Categories),
                                   nameof(GameDetailsViewModel.CategoryVisibility));

            SetItemsControlBinding(ref ItemsTags, "PART_ItemsTags",
                                   nameof(GameDetailsViewModel.SetTagFilterCommand),
                                   nameof(GamesCollectionViewEntry.Tags),
                                   nameof(GameDetailsViewModel.TagVisibility));

            SetItemsControlBinding(ref ItemsLinks, "PART_ItemsLinks",
                                   nameof(GameDetailsViewModel.OpenLinkCommand),
                                   nameof(GamesCollectionViewEntry.Links),
                                   nameof(GameDetailsViewModel.LinkVisibility),
                                   nameof(Link.Url));
        }
Ejemplo n.º 29
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            if (Template != null)
            {
                ViewHost = Template.FindName("PART_ViewHost", this) as FrameworkElement;
                if (ViewHost != null)
                {
                    ViewHost.InputBindings.Add(new KeyBinding()
                    {
                        Command = mainModel.ToggleGameDetailsCommand, Key = Key.Back
                    });
                    ViewHost.InputBindings.Add(new KeyBinding()
                    {
                        Command = mainModel.ToggleGameDetailsCommand, Key = Key.Escape
                    });
                    ViewHost.InputBindings.Add(new KeyBinding()
                    {
                        Command = mainModel.SelectPrevGameCommand, Key = Key.F2
                    });
                    ViewHost.InputBindings.Add(new KeyBinding()
                    {
                        Command = mainModel.SelectNextGameCommand, Key = Key.F3
                    });
                    ViewHost.InputBindings.Add(new XInputBinding(mainModel.ToggleGameDetailsCommand, XInputButton.B));
                    ViewHost.InputBindings.Add(new XInputBinding(mainModel.SelectPrevGameCommand, XInputButton.LeftShoulder));
                    ViewHost.InputBindings.Add(new XInputBinding(mainModel.SelectNextGameCommand, XInputButton.RightShoulder));

                    BindingTools.SetBinding(ViewHost,
                                            FocusBahaviors.FocusBindingProperty,
                                            mainModel,
                                            nameof(mainModel.GameDetailsFocused));
                }

                ButtonContext = Template.FindName("PART_ButtonContext", this) as ButtonBase;
                if (ButtonContext != null)
                {
                    BindingTools.SetBinding(
                        ButtonContext,
                        ButtonBase.CommandProperty,
                        mainModel,
                        $"{nameof(mainModel.SelectedGameDetails)}.{nameof(mainModel.SelectedGameDetails.ContextActionCommand)}");
                    BindingTools.SetBinding(
                        ButtonContext,
                        ButtonBase.ContentProperty,
                        mainModel,
                        $"{nameof(mainModel.SelectedGameDetails)}.{nameof(mainModel.SelectedGameDetails.ContextActionDescription)}");
                }

                ButtonOptions = Template.FindName("PART_ButtonOptions", this) as ButtonBase;
                if (ButtonOptions != null)
                {
                    ButtonOptions.Command = mainModel.ToggleGameOptionsCommand;
                }

                ImageCover = Template.FindName("PART_ImageCover", this) as Image;
                if (ImageCover != null)
                {
                    var sourceBinding = new PriorityBinding();
                    sourceBinding.Bindings.Add(new Binding()
                    {
                        Path      = new PropertyPath(nameof(GamesCollectionViewEntry.CoverImageObject)),
                        Converter = new NullToDependencyPropertyUnsetConverter()
                    });
                    sourceBinding.Bindings.Add(new Binding()
                    {
                        Path      = new PropertyPath(nameof(GamesCollectionViewEntry.DefaultCoverImageObject)),
                        Converter = new NullToDependencyPropertyUnsetConverter()
                    });

                    BindingOperations.SetBinding(ImageCover, Image.SourceProperty, sourceBinding);
                }

                ImageBackground = Template.FindName("PART_ImageBackground", this) as FadeImage;
                if (ImageBackground != null)
                {
                    BindingTools.SetBinding(ImageBackground,
                                            FadeImage.SourceProperty,
                                            nameof(GamesCollectionViewEntry.DisplayBackgroundImage));
                }
            }
        }
Ejemplo n.º 30
0
 // Start is called before the first frame update
 void Start()
 {
     fade       = GameObject.FindGameObjectWithTag("Fade").GetComponent <FadeImage>();
     fade.Range = 1.0f;
 }