コード例 #1
0
        private void OpenGame_Click(object sender, RoutedEventArgs e)
        {
            OpenGameWindow gameWindow = new OpenGameWindow(this);
            var            game       = (Game)((Button)sender).Tag;

            gameWindow.currentGameLabel.Content = game.Name.ToUpper();
            gameWindow.selectedGame             = game;

            using (AppDbContext db = new AppDbContext())
            {
                db.Games.Load();
                db.Users.Load();
                Game selGame = db.Games.Find(game.Id);

                List <Comment> comments = new List <Comment>();
                foreach (var comment in selGame.Comments)
                {
                    comments.Add(comment);
                }
                gameWindow.listOfComments.ItemsSource = comments;

                if (comments.Count() == 0)
                {
                    gameWindow.CommentsTextBlock.Text = "Отзывы отсутвуют"; gameWindow.CommentsScrollViewer.Visibility = Visibility.Hidden;
                }
                else
                {
                    gameWindow.CommentsTextBlock.Text = "Отзывы"; gameWindow.CommentsScrollViewer.Visibility = Visibility.Visible;
                }

                User user         = db.Users.Find(App.CurrentUser.Id);
                bool isItUserGame = user.Games.Contains(selGame);
                if (isItUserGame)
                {
                    gameWindow.buttonAdd.IsEnabled = false;
                }
            }

            hideGamesRectangle.Opacity = 0.4;
            ListViewGames.Opacity      = 0.6;
            gameWindow.ShowDialog();
        }
コード例 #2
0
    static void Init()
    {
        Controller.resetInstance();
        openedWindow = WelcomeWindowType.New;

        Language.Initialize();
        thisWindowReference = EditorWindow.GetWindow(typeof(WelcomeWindow));
        windowWidth         = EditorWindow.focusedWindow.position.width;
        windowHeight        = EditorWindow.focusedWindow.position.height;
        logo = (Texture2D)Resources.Load("EAdventureData/img/logo-editor", typeof(Texture2D));

        logoRect    = new Rect(0.01f * windowWidth, 0.01f * windowHeight, windowWidth * 0.98f, windowHeight * 0.25f);
        buttonsRect = new Rect(0.01f * windowWidth, 0.27f * windowHeight, windowWidth * 0.98f, windowHeight * 0.28f);
        windowRect  = new Rect(0.01f * windowWidth, 0.32f * windowHeight, 0.98f * windowWidth, 0.67f * windowHeight);

        //newGameWindow = new NewGameWindow(windowRect, new GUIContent(TC.get("GeneralText.New")), "Window");
        //openGameWindow = new OpenGameWindow(windowRect, new GUIContent(TC.get("GeneralText.Open")), "Window");
        newGameWindow  = new NewGameWindow(windowRect, new GUIContent("New"), "Window");
        openGameWindow = new OpenGameWindow(windowRect, new GUIContent("Open"), "Window");
        //recentGameWindow = new RecentGameWindow(windowRect, new GUIContent(Language.GetText("RECENT_GAME")), "Window");
    }