Skip to content

jamesnet214/tictactoe-wpf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TicTacToe WPF

이 리포지토리는 TicTacToe를 WPF로 구현한 리포지토리입니다.

더 알아보기 »

Star License Activity
Github Stars License Commits-per-month

Contents


개요

image

틱택토는 두 명이 번갈아가며 O와 X를 3×3 판에 써서 같은 글자를 가로, 세로, 혹은 대각선 상에 놓이도록 하는 놀이다.   - Wikipedia

틱택토는 게임 방식과 로직이 간단하여 연습 목적으로 만들어보기 좋은 게임입니다.
또한 C, Python 등 다양한 언어로 구현된 예제들이 풍부합니다.

이제 WPF로 구현한 틱택토를 함께 즐겨보시기 바랍니다!


개발 환경

✔️ WPF .NET Core   [.NET 6.0]

✔️ Visual Studio 2022

✔️ C# 10.0

11


학습 가이드

  • 숙련자: C#과 WPF를 접해본 개발자라면 약 2시간 이내에 소스코드 전체를 작성하고 실행시킬 수 있습니다.
  • 초보자: WPF와 MVVM의 이해가 부족하더라도 약 6시간 이내에 소스코드 전체를 작성하고 실행시킬 수 있습니다.

틱택토를 통해 학습할 수 있는 기술들은 아래와 같습니다.

  • CustomControl
  • Trigger
  • Mvvm 패턴
  • DataContext
  • RelayCommand
  • Binding
  • RelativeSource TemplatedParent
  • ListBox / ListBoxItem
  • ItemsPresenter
  • ContentPresenter
  • GetContainerForItemOverride
  • OnApplyTemplate
  • Geometry
  • Hex Color
  • Transparent
  • Application

WPF의 중요한 핵심 기술들을 이 앱을 통해 깊이있게 학습할 수 있습니다.


WPF 구조

소스코드는 Local Themes UI 3개의 폴더 구조로 구성되어 있습니다. 각각의 폴더는 기능, 리소스, UI를 담당합니다.

Local

     - Data
     - Mvvm
     - ViewModel

Themes

     - Controls

UI

     - Units
     - Views

Local

로컬 기반에서 필요한 클래스 영역입니다. Model, Converter, 각종 Helper, Mvvm에 필요한 모듈, ViewModel 등 로컬에서 필요한 모든 클래스를 이 위치에서 관리합니다.

Themes

Generic.xaml을 포함한 리소스 분기 영역입니다. DefaultStyleKey에 해당하는 리소스를 약속된 위치(Generic.xaml)에서 다시 한번 ResourceDictionary 파일을 통해 분기하여 관리하도록 합니다.

UI

DeafultStyleKey를 포함하는 CustomControl 영역입니다. Units 폴더는 ListBox, ListBoxItem, Button 등과 같이 하위 요소 수준의 컨트롤 객체를 포함합니다. 그리고 Views 폴더는 Window, UserControl, ContentControl과 같이 UI 레이아웃을 담당할 수 있는 ContentPresenter 객체를 포함합니다.

image


MVVM

MVVM 패턴을 사용하기 위해서는 INotifyPropertyChanged가 구현된 클래스가 필요합니다. 해당 앱에서는 별도의 라이브러리를 사용하지 않고 기본적으로 필요한 메서드만 로컬에 구현해서 사용합니다.

ObservableObject

using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace TicTacToe.Local.Mvvm
{
    public class ObservableObject : INotifyPropertyChanged
    {
	public event PropertyChangedEventHandler PropertyChanged;
	protected void OnPropertyChanged([CallerMemberName] string name = null)
	{
	    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
	}
    }
}

ScreenShot

image

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages