Skip to content

Commit

Permalink
1차 커밋
Browse files Browse the repository at this point in the history
  • Loading branch information
KorStrix committed Jul 23, 2024
1 parent 250e266 commit fdd885c
Show file tree
Hide file tree
Showing 47 changed files with 1,057 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8-bom
trim_trailing_whitespace = false
insert_final_newline = false

[*.cs]
dotnet_diagnostic.IDE0044.severity = none # ignore readonly
dotnet_diagnostic.IDE0090.severity = none # 'new' expression can be simplified"
dotnet_diagnostic.IDE0017.severity = none # 개체 초기화를 간단하게 만들 있습니다.
dotnet_diagnostic.IDE0028.severity = none # 컬렉션 초기화를 단순화할 있습니다.
dotnet_diagnostic.IDE0066.severity = none # 'switch' 사용

dotnet_diagnostic.CS0136.severity = error # A local or parameter named '변수명' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter

dotnet_diagnostic.IDE0051.severity = none
dotnet_diagnostic.CS1591.severity = warning # 모든 public은 주석을 달게 합니다
45 changes: 45 additions & 0 deletions .github/workflows/copy-to-workspace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 이 워크플로는 파일을 카피합니다.
#
# workflow syntax
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions

name: copy to workspace

on:
push:
branches:
- master # match env.SRC_BRANCH

env:
# Require unity test
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_VERSION: 2019.3.8f1

# require Deploy
DEST_OWNER: unity-korea-community
SRC_BRANCH: master
WORK_PATH: /.
DEST_BRANCH: workspace
DEST_PATH: Packages/${{ github.event.repository.name }}/

jobs:
copy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.SRC_BRANCH }}
lfs: true

- name: Deploy
uses: andstor/[email protected] # https://github.com/marketplace/actions/copycat-action
with:
personal_token: ${{ secrets.ACCESS_TOKEN }} #require
src_branch: ${{ env.SRC_BRANCH }}
src_path: ${{ env.WORK_PATH }} #require
dst_owner: ${{ env.DEST_OWNER }} #require
dst_repo_name: ${{ github.event.repository.name }} #require
dst_branch: ${{ env.DEST_BRANCH }}
dst_path: ${{ env.DEST_PATH }}
clean: true
50 changes: 50 additions & 0 deletions .github/workflows/manual-copy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 이 워크플로는 파일을 카피합니다.
#
# workflow syntax
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions

name: manual copy

on:
workflow_dispatch:
inputs:
SRC_PATH:
default: Packages/${{ github.event.repository.name }}/
description: copy to dstPath
required: true
DST_PATH:
default: /.
description: copy to dstPath
required: true

env:
# Require unity test
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_VERSION: 2019.3.8f1

# require Deploy
SRC_BRANCH: workspace
DST_OWNER: unity-korea-community
DST_BRANCH: master

jobs:
copy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.SRC_BRANCH }}
lfs: true

- name: Deploy
uses: andstor/[email protected] # https://github.com/marketplace/actions/copycat-action
with:
personal_token: ${{ secrets.ACCESS_TOKEN }} #require
src_branch: ${{ env.SRC_BRANCH }}
src_path: ${{ github.event.inputs.SRC_PATH }} #require
dst_owner: ${{ env.DST_OWNER }} #require
dst_repo_name: ${{ github.event.repository.name }} #require
dst_branch: ${{ env.DST_BRANCH }}
dst_path: ${{ github.event.inputs.DST_PATH }}
clean: true
29 changes: 29 additions & 0 deletions .github/workflows/publish-npm-on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 출처 : https://forum.unity.com/threads/publish-unity-package-with-npmjs.882010/
name: Publish to npm on release

# Controls when the action will run.
# In this case, I'm saying on each release event when it's specifically a new release publish, the types: [published] is required here,
# since releases could also be updated or deleted, we only want to publish to npm when a new release is created (published).
on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
#Install Node.js, with the version 12 and using the registry URL of npm, this could be changed to a custom registry or the GitHub registry.
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/

# Command to install the package dependencies
- run: yarn install

# Publish to npm
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
52 changes: 52 additions & 0 deletions .github/workflows/publish-unitypackage-release-on-push-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: release

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# https://github.com/battila7/get-version-action
- id: get_version
uses: battila7/get-version-action@v2

- run: |
find ./ -name "*.meta"
find ./ -name "*.meta" > metalist
# https://github.com/pCYSl5EDgo/create-unitypackage
- uses: pCYSl5EDgo/create-unitypackage@master
with:
package-path: ${{ github.event.repository.name }}-${{ steps.get_version.outputs.version }}.unitypackage
include-files: metalist

- uses: actions/upload-artifact@master
with:
path: ${{ github.event.repository.name }}-${{ steps.get_version.outputs.version }}.unitypackage
name: package

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.event.repository.name }}-${{ steps.get_version.outputs.version }}.unitypackage
asset_name: ${{ github.event.repository.name }}-${{ steps.get_version.outputs.version }}.unitypackage
asset_content_type: application/gzip
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 unity-korea-community

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions LICENSE.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# ServiceLocator
# unity-service-locator

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## 소개

Service Locator 패턴을 유니티에 맞게 구현했습니다.

7 changes: 7 additions & 0 deletions README.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Runtime.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Runtime/ServiceLocator.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions Runtime/ServiceLocator/IServiceLocator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using UnityEngine.Events;

namespace UNKO.ServiceLocator
{
public interface IServiceLocator
{
UnityEvent<Type> OnServiceRegistered { get; }

T GetService<T>() where T : class;
void RegisterService<T>(T service, params Type[] types) where T : class;
void UnregisterService<T>() where T : class;
}

public static class IServiceLocatorEx
{
public static void RegisterServiceAndInterfaces<T>(this IServiceLocator locator, T service) where T : class
{
Type[] interfaces = service.GetType().GetInterfaces();
locator.RegisterService(service, interfaces);
}

public static void RegisterService<T>(this IServiceLocator locator, T service) where T : class
=> locator.RegisterService(service, typeof(T));

public static bool TryGetService<T>(this IServiceLocator locator, out T service) where T : class
{
service = locator.GetService<T>();
return service != null;
}
}
}
11 changes: 11 additions & 0 deletions Runtime/ServiceLocator/IServiceLocator.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fdd885c

Please sign in to comment.