[링크] 붕괴3 방식의 카툰렌더링 구현하기
'Programming > Shader' 카테고리의 다른 글
HLSL 내장함수 (0) | 2012.06.25 |
---|---|
쉐이더(Shader) 2.0 3.0 차이 (0) | 2012.06.25 |
HLSL 내장함수 (0) | 2012.06.25 |
---|---|
쉐이더(Shader) 2.0 3.0 차이 (0) | 2012.06.25 |
[추가]
스토어로 올라간 빌드는 iTunes Connect에서 dSYM 파일을 받아야 합니다.
[위치] iTunes Connect-나의 앱-(해당 앱)-활동 내역-해당 빌드 버전-일반 정보-기호 포함-dSYM 다운로드
Crashlytics에서 crash report를 보는데 Missing dSYM 창이 떴습니다.
dSYM 파일이 뭐길래 그러지 찾아보니까 dSYM 파일은 앱의 디버그 심볼을 저장하고 있다고 합니다. [링크]
Xcode의 메뉴에서 Window - Organizer 에서 아카이빙 된 파일들을 찾아 Show in Finder로 xcarchive파일을 확인할 수 있습니다.(제 컴퓨터에서는 열리지 않았습니다.)
또는 Xcode - Preferences - Locations - Archives에서 경로를 확인할 수 있습니다.
해당 경로에서 해당 날짜에 해당하는 xcarchive 파일을 확인하고, 패키지 내용보기를 통해 dSYM 파일을 얻을 수 있었습니다.
dSYMs 파일은 Window - Organizer 에서 확인하거나 Xcode - Preferences - Locations - Archives에서 xcarchive 파일을 찾아 얻을 수 있습니다.
[출처] http://minsone.github.io/mac/ios/where-is-the-dsym-file-in-xcode
[Xcode]dSYM 파일은 어디 있나요?
Crashlytics에서 crash report를 보는데 Missing dSYM 창이 떴습니다. dSYM 파일이 뭐길래 그러지 찾아보니까 dSYM 파일은 앱의 디버그 심볼을 저장하고 있다고 합니다. [링크] Xcode의 메뉴에서 Window - Organizer 에서 아카이빙 된 파일들을 찾아 Show in Finder로 xcarchive파일을 확인할 수 있습니다.(제 컴퓨터에서는 열리지 않았습니다.) 또는 Xcode - Preferences - Loca
minsone.github.io
Unity3D UI CoverFlow and other Layout options
Some years ago I was required to build a simple Cover Flow Layout (think, iTunes Carousel). Originally I build the project in a Windows Forms application for a client we were working with. Sometime later we then needed a similar system in a project we were doing in Unity3D.
This is just a simple recreation of that work.
Its very old, and it wasn’t originally done in GitHub so I’ve just commited the whole project in one commit.
There are some simple layouts included to demonstrate the flexibility of the system,
Cell reuse is supported using a simple Cell Pool with UICollectionCells registering Prefabs as “nibs” to be reused.
Data “binding” can be expanded upon with the cell reuse.
All layouts have various settings to tweak positions, speeds, snapping, wrapping and the like. These can also be updated at runtime in the editor to see results in real time.
Here’s a few GIFs showing the layouts in action in the editor (GIFs are only at 30fps and appear to have bad artifacts in them, running in the editor is obviously at full FPS with no rendering issues).
Cover Flow Layout
Carousel Layout
Messy Paper Layout
Layouts can have multiple configurable elements, here’s an example of the Cover Flow properties being edited at runtime…
[출처] https://unitylist.com/p/1xt/Unity-Cover-Flow
Unity Cover Flow
Unity3D UI CoverFlow and other Layout options
unitylist.com
[GitHub] Unity UI Extensions (0) | 2024.10.22 |
---|---|
[펌] UGUI Image 버튼 영역(Collider) 크기 지정 (0) | 2018.12.12 |
[링크] 화면 해상도와 스케일링 (0) | 2018.12.03 |
[링크] uGui 사용시 인풋에 의한 오브젝트 이벤트(Raycast,EventSystem) 일률화 (0) | 2018.11.22 |
[펌] EventSystem설정 터치 감도 조절 (0) | 2016.09.22 |
It forces to sample current state of animations. "Sample animations" means: put character in the position defined by animation states. Sampling always happens between Update and LateUpdate automatically, but in some cases you might want to sample animations yourself. My most common case: I want to put character in pose of first frame some specific animation on Start, so I would do something like this:
void Start()
{
AnimationState state = animation["Aim"];
state.enabled = true;
state.weight = 1;
state.normalizedTime = 0;
animation.Sample();
}
[출처] https://answers.unity.com/questions/46869/animationsample-usage.html
[펌] Unity5のPostProcessBuildでXcode Capabilityの設定する方法 (0) | 2019.06.03 |
---|---|
[펌] Enable Push Notification in XCode project by default? (0) | 2019.06.03 |
[펌] 타임서버에서 시각 가져와서 Unity 에서 사용하기 (NST, NIST) (0) | 2019.04.15 |
[펌] Async-Await instead of coroutines in Unity 2017 (0) | 2019.02.21 |
[펌] 웹 페이지 상의 이미지를 읽어와 출력하기 (0) | 2018.12.21 |
[링크] https://hongjinhyeon.tistory.com/92
[C#] Using 사용
사용 용도는 2가지가 있습니다. 1.지시문(Directive) 다른 네임스페이스에 정의된 타입을 Import 하거나, 네임스페이스에 대한 별칭을 만들때 사용한다. 1 2 using System.Text; //코드 상단에 네임스페이스 정의..
hongjinhyeon.tistory.com
[펌][c#] 한국 원화 \ 표시하기 (0) | 2020.01.09 |
---|---|
[펌] 현재 날짜 만 C#으로 가져 오기 (0) | 2019.10.23 |
[펌] c# Split (문자열 분할, 자르기) (0) | 2019.04.18 |
[Link] NTP client library for .Net platforms (0) | 2019.03.28 |
[링크] 코드에 부가 정보를 기록하는 어트리뷰트 (Attribute) (0) | 2019.01.31 |
[링크] NGUI 사용 흐르는 문자열 만들기 (0) | 2019.08.26 |
---|---|
[NGUI] 초당 터치 횟수 제한 (0) | 2019.07.08 |
[수정] NGUI UISprite/UITexture GrayScale/Intencity (0) | 2018.07.13 |
[펌] EmojiLabel (for NGUI with dynamic font) (0) | 2018.06.07 |
Useful stuff for NGUI (0) | 2018.06.07 |
iOS 10 버전 부터, Apple은 앱 개발자에게 사용하는 프레임웍에 대한 설명을 info.plist 파일에 기술하도록 요청하고 있습니다. 이 설명은 사용자에게 해당 기능 사용에 대한 허가를 요청할때 보여지게 됩니다(e.g. location, accelerometer, etc.). 이 요구사항은 탭조이 같은 써드파티 SDK까지 확대 되었습니다. 탭조이는 편의를 위해 탭조이가 사용하고 있는 프레임웍에 대해서 info.plist에 포함해야할 내용을 다음과 같이 제공해 드립니다.
Function | Key | Suggested Text |
Accessing media library | NSAppleMusicUsageDescription | 광고 경험 향상을 위해서 미디어 라이브러리가 사용됩니다. |
Accessing location data all time* | NSLocationAlwaysUsageDescription | 광고 경험 향상을 위해서 위치 정보에 접근할 수 있습니다. |
Accessing location data when the app is in use* | NSLocationWhenInUseUsageDescription | 광고 경험 향상을 위해서 위치 정보에 접근할 수 있습니다. |
Accessing accelerometer | NSMotionUsageDescription | 광고 경험 향상을 위해서 가속센서를 사용할 수 있습니다. |
Accessing photo library | NSPhotoLibraryUsageDescription | 개인화된 광고 경험 향상을 위해서 사진 정보에 접근할 수 있습니다. |
* SDK 11.9.0부터 CoreLocation.framework 은 optional 입니다.
만일 위와 같은 정보를 info.plist에 추가하지 않으면 다음과 같은 사유로 앱스토어 등록이 거부될 수 있습니다.
This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSAppleMusicUsageDescription key with a string value explaining to the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSLocationAlwaysUsageDescription key with a string value explaining to the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSLocationWhenInUseDescription key with a string value explaining to the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSMotionUsageDescription key with a string value explaining to the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
보다 자세한 정보는 Apple Developer Forum의 내용을 확인해 주세요. info.plist 수정 방법은 Apple이 제공하는 info.plist 관련 문서를 참조해 주세요.
[출처] https://dev.tapjoy.com/ko/faq/ios-10-data-authorization/
ITMS-90683: Missing Purpose String in Info.plist (0) | 2020.04.28 |
---|---|
[펌] 설정-일반-"프로파일" 메뉴가 없네요 (0) | 2019.11.12 |
[링크] 아이폰, 150MB 초과 앱, 셀룰러 데이터로 다운로드 우회 방법 (0) | 2018.09.22 |
[펌] Xcode - 빌드 오류 Development cannot be enabled while your device is locked. (0) | 2017.12.01 |
[펌] iOS10 아이폰 음악 넣기 정말 쉬워요 (0) | 2017.05.06 |
[링크]
https://github.com/setchi/FancyScrollView
setchi/FancyScrollView
A scrollview component that can implement highly flexible animation. - setchi/FancyScrollView
github.com
English (by Google Translate)
高度に柔軟なアニメーションを実装できる汎用の ScrollView コンポーネントです。 無限スクロールもサポートしています。
Asset Store からパッケージをプロジェクトにインストールします。
プロジェクトディレクトリの Packages/manifest.json ファイルにリポジトリへの参照を追加します。
{ "dependencies": { "jp.setchi.fancyscrollview": "https://github.com/setchi/FancyScrollView.git#upm" } }
このリポジトリを Clone または Download します。
FancyScrollView はセルの位置を更新するとき、可視領域の正規化された値を各セルに渡します。セル側では、0.0 ~ 1.0 の値に基づいてスクロールの外観を自由に制御できます。サンプルでは Animator を使用してセルの動きを制御しています。
表示に必要なセル数のみが生成され、セルは再利用されます。
Context 経由で、セルがクリックされたことをスクロールビューで検知したり、スクロールビューからセルに指示を出す処理がシンプルに実装できます。実装例(Examples/02_FocusOn)が含まれていますので、参考にしてください。
移動にかける秒数や Easing の指定もできます。詳しくは API Reference の Scroller - Methods を参照してください。
慣性の有無、減速率などスクロールに関する挙動の設定ができます。詳しくは API Reference の Scroller - Inspector を参照してください。
スナップを有効にすると、スクロールが止まる直前に最寄りのセルへ移動します。スナップがはじまる速度のしきい値、移動にかける秒数、 Easing を指定できます。
Inspector で下記の設定をすることで無限スクロールを実装できます。
実装例(Examples/03_InfiniteScroll)が含まれていますので、こちらも参考にしてください。
FancyScrollView/Examples を参照してください。
NameDescription
01_Basic | 最もシンプルな構成の実装例です。 |
02_FocusOn | ボタンで左右のセルにフォーカスする実装例です。 |
03_InfiniteScroll | 無限スクロールの実装例です。 |
もっともシンプルな構成では、
の実装が必要です。
セルにデータを渡すためのオブジェクトを定義します。
public class ItemData { public string Message; }
FancyScrollViewCell<TItemData> を継承して自分のセルを実装します。
using UnityEngine; using UnityEngine.UI; using FancyScrollView; public class MyScrollViewCell : FancyScrollViewCell<ItemData> { [SerializeField] Text message = default; public override void UpdateContent(ItemData itemData) { message.text = itemData.Message; } public override void UpdatePosition(float position) { // position は 0.0 ~ 1.0 の値です // position に基づいてスクロールの外観を自由に制御できます } }
FancyScrollView<TItemData> を継承して自分のスクロールビューを実装します。
using UnityEngine; using System.Linq; using FancyScrollView; public class MyScrollView : FancyScrollView<ItemData> { [SerializeField] Scroller scroller = default; [SerializeField] GameObject cellPrefab = default; protected override GameObject CellPrefab => cellPrefab; void Start() { scroller.OnValueChanged(base.UpdatePosition); } public void UpdateData(IList<ItemData> items) { base.UpdateContents(items); scroller.SetTotalCount(items.Count); } }
スクロールビューにデータを流し込みます。
using UnityEngine; using System.Linq; public class EntryPoint : MonoBehaviour { [SerializeField] MyScrollView myScrollView = default; void Start() { var items = Enumerable.Range(0, 20) .Select(i => new ItemData {Message = $"Cell {i}"}) .ToArray(); myScrollView.UpdateData(items); } }
セルを制御するスクロールビューの抽象基底クラスです。
public abstract class FancyScrollView<TItemData, TContext> : MonoBehaviour where TContext : class, new()
Context が不要な場合はこちらを使用します。
public abstract class FancyScrollView<TItemData> : FancyScrollView<TItemData, FancyScrollViewNullContext>
TypeNameSummary
float | Cell Spacing | セル同士の間隔を float.Epsilon ~ 1.0 の間で指定します. |
float | Scroll Offset | スクロールのオフセットを指定します.たとえば、 0.5 を指定してスクロール位置が 0 の場合、最初のセルの位置は 0.5 になります. |
bool | Loop | オンにするとセルが循環し、最初のセルの前に最後のセル、最後のセルの後に最初のセルが並ぶようになります.無限スクロールさせたい場合はオンにします. |
Transform | Cell Container | セルの親要素となる Transform を指定します. |
TypeNameSummary
GameObject | CellPrefab | Cell prefab. |
IList<TItemData> | ItemsSource | Items source. |
TContext | Context | Context. |
TypeNameSummary
void | UpdateContents(IList<TItemData> itemsSource) | Updates the contents. |
void | Refresh() | Refreshes the cells. |
void | UpdatePosition(float position) | Updates the scroll position. |
セルの抽象基底クラスです。
public abstract class FancyScrollViewCell<TItemData, TContext> : MonoBehaviour where TContext : class, new()
Context が不要な場合はこちらを使用します。
public abstract class FancyScrollViewCell<TItemData> : FancyScrollViewCell<TItemData, FancyScrollViewNullContext>
TypeNameSummary
int | Index | Gets or sets the index of the data. |
bool | IsVisible | Gets a value indicating whether this cell is visible. |
TContext | Context | Context. |
TypeNameSummary
void | SetupContext(TContext context) | Setup the context. |
void | SetVisible(bool visible) | Sets the visible. |
void | UpdateContent(TItemData itemData) | Updates the content. |
void | UpdatePosition(float position) | Updates the position. |
スクロール位置を制御するコンポーネントです。
public class Scroller : UIBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler
TypeNameSummary
RectTransform | Viewport | ビューポートとなる RectTransform を指定します.ここで指定された RectTransform の範囲内でジェスチャーの検出を行います. |
ScrollDirection | Direction Of Recognize | ジェスチャーを認識する方向を Vertical か Horizontal で指定します. |
MovementType | Movement Type | コンテンツがスクロール範囲を越えて移動するときに使用する挙動を指定します. |
float | Elasticity | コンテンツがスクロール範囲を越えて移動するときに使用する弾力性の量を指定します. |
float | Scroll Sensitivity | スクロールの感度を指定します. |
bool | Inertia | 慣性のオン/オフを指定します. |
float | Deceleration Rate | Inertia がオンの場合のみ有効です.減速率を指定します. |
bool | Snap.Enable | Snap を有効にする場合オンにします. |
float | Snap.Velocity Threshold | Snap がはじまる閾値となる速度を指定します. |
float | Snap.Duration | Snap 時の移動時間を秒数で指定します. |
Ease | Snap.Easing | Snap 時の Easing を指定します. |
TypeNameSummary
void | OnValueChanged(Action<float> callback) | スクロール位置が変化したときのコールバックを設定します. |
void | OnSelectionChanged(Action<int> callback) | 選択セルが変化したときのコールバックを設定します. |
void | JumpTo(int index) | 指定したセルまでジャンプします. |
void | ScrollTo(int index, float duration) | 指定したセルまでスクロールします. |
void | ScrollTo(int index, float duration, Ease easing) | 指定したセルまでスクロールします. |
void | ScrollTo(int index, float duration, Func<float, float> easingFunction) | 指定したセルまでスクロールします. |
void | SetTotalCount(int totalCount) | アイテムの総数を設定します. ( index: 0 ~ totalCount - 1 ) |
MIT
[링크] [NATIVE, ANDROID] Local Notification(로컬 알림) 유니티 플러그인 (0) | 2019.07.01 |
---|---|
[펌] Unity Local Notification (For android) (0) | 2019.07.01 |
[링크] Simple Unity browser (0) | 2019.03.28 |
[링크] 유니티랑 nodejs 간단 연동 테스트 해보기 (0) | 2019.03.08 |
[펌] Socket.io-Client for Unity3D 소개 (0) | 2019.03.08 |
(http://link2me.tistory.com 에서 발췌)
기타 : split를 string문자열로 자를때 word_1.Split(new string[] {"\\"}, StringSplitOptions.None) C# Split함수의 경우 직접 문자열을 구분자로 줄수 없다.
Split 은 기본적으로 문자를 입력 받도록 되어 있다. 문자열을 char[]형식으로 변경 후 사용 가능하다.
string str = "서울시/서초구/양재동";
string[] result = str.Split(new char[] { '/' }); // /를 기준으로 잘라서 배열 result 에 넣어라.
for (int i = 0; i < result.Length ; i++) // 배열은 0 부터 저장되며, 배열의 길이만큼 순환
{
MessageBox.Show(i + "번째 배열 ==> " + result[i]);
}
string str = "jsk005@naver.com";
char[] sp ="@".ToCharArray();
string[] result = str.Split(sp);
for (int i = 0; i < result.Length; i++)
{
MessageBox.Show(i + "번째 배열 ==> " + result[i]);
}
string str = "홍 길 동";
string[] result = str.Split(new char[] {' '}); // new char[] {} 로 해도 공백으로 나눈다는 의미
for (int i = 0; i < result.Length; i++)
{
MessageBox.Show(i + "번째 배열 ==> " + result[i]);
}
위의 예제와 아래 예제의 차이점을 보면 split 구분자가 문자(char)가 아니라 문자열(string)이다.
string 으로 할 경우에는 반드시 StringSplitOptions.None 또는 StringSplitOptions.RemoveEmptyEntries 까지 추가해줘야만 에러가 발생하지 않는다. 물론 위의 것도 StringSplitOptions 를 추가해줘도 된다.
string str = "홍길동~~~이순신~~~강감찬~~~을지문덕";
string[] result = str.Split(new string[] {"~~~"}, StringSplitOptions.None);
for (int i = 0; i < result.Length; i++)
{
MessageBox.Show(i + "번째 배열 ==> " + result[i]);
}
string[] separator = new string[1] { "\r\n\r\n" }; //분리할 기준 문자열
string[] strResult = s.Split(separator, StringSplitOptions.RemoveEmptyEntries);
* StringSplitOptions.None // 반환값에 빈 부분 문자열 포함됨
* StringSplitOptions.RemoveEmptyEntries // 반환값에 빈 부분 문자열 포함 안됨
foreach (string strValue in strResult)
{
}
또는
for (var i =0 ; i < strResult.Length ; i++)
{
}
//구글링해서 찾은걸 약간 수정해서 테스트하고 적어둠
string str = "[stop]ONE[stop][stop]TWO[stop][stop][stop]THREE[stop][stop]";
string[] stringSeparators = new string[] { "[stop]" };
string[] result = str.Split(stringSeparators, StringSplitOptions.None);
for (int i = 0; i < result.Length; i++)
{
if (String.IsNullOrEmpty(result[i])) // 문자열이 null 이거나 공백이면
{
MessageBox.Show("null" + result[i]);
}
else
{
MessageBox.Show(i + "번째 배열 ==> " + result[i]);
}
}
아래와 같이StringSplitOptions.RemoveEmptyEntries 으로 수정하면 결과가 어떻게 나올까?
string str = "[stop]ONE[stop][stop]TWO[stop][stop][stop]THREE[stop][stop]";
string[] stringSeparators = new string[] { "[stop]" };
string[] result = str.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
// 반환값에 빈 부분 문자열 포함 안됨
for (int i = 0; i < result.Length; i++)
{
if (String.IsNullOrEmpty(result[i]))
{
MessageBox.Show("null" + result[i]);
}
else
{
MessageBox.Show(i + "번째 배열 ==> " + result[i]);
}
}
결과는 null 이나 공백은 무시되므로 배열은 0, 1, 2 만 추출된다.
정규식을 이용한 문자열 분리
System.Text.RegularExpressions.Regex.Split(자를 문자열, 정규식 문자열)
using System;
using System.Text.RegularExpressions;
string str = "cat\r\ndog\r\nanimal\r\nperson";
string[] result = Regex.Split(str, "\r\n");
for (int i = 0; i < result.Length; i++)
{
MessageBox.Show(i + "번째 배열 ==> " + result[i]);
}
포함된 문자열의 개수 구하기
int count = source.Split('/').Length - 1;
[펌] 현재 날짜 만 C#으로 가져 오기 (0) | 2019.10.23 |
---|---|
[링크] Using 사용 (0) | 2019.05.07 |
[Link] NTP client library for .Net platforms (0) | 2019.03.28 |
[링크] 코드에 부가 정보를 기록하는 어트리뷰트 (Attribute) (0) | 2019.01.31 |
[링크] C# string double 변환 7가지 방법 (0) | 2018.08.01 |
NIST 타임서버에서 시간가져오기 (NST)
아래와 같은 코드로 가져올 수 있다.
Unity 에서 사용할 수 있다.
using System; using System.IO; using System.Collections; using System.Collections.Generic; using UnityEngine; public class TimeServer : MonoBehaviour { [SerializeField] private string _comment = "만료시킬 날짜를 적으세요 (한국시각 기준)"; public int _yyyy, _mm, _dd; private DateTime _expireDateTime, _nowServerDateTime, _nowLocalDateTime; private TimeSpan _duration; // Use this for initialization void Start () { // 한국 시각 _duration = System.TimeSpan.FromHours(9); _expireDateTime = new DateTime(Mathf.Clamp(_yyyy, 1900, 3000), Mathf.Clamp(_mm, 1,12), Mathf.Clamp(_dd, 1, 31)); _nowLocalDateTime = DateTime.Now; _nowServerDateTime = GetNISTDate().Add(_duration); if (Debug.isDebugBuild) { Debug.LogWarning("만료지정일 : " + _expireDateTime); Debug.LogWarning("현재 로컬 시각 :" + _nowLocalDateTime); Debug.LogWarning("현재 서버 시각 :" + _nowServerDateTime); } if (_nowLocalDateTime < _expireDateTime) { if (_nowServerDateTime < _expireDateTime) { // Debug.Log("실행"); } else { // Debug.Log("서버 체크 결과 만료 됨"); } } else { // Debug.Log("로컬 체크 결과 만료 됨"); } } #region NTPTIME //NTP time 을 NIST 에서 가져오기 // 4초 이내에 한번 이상 요청 하면, ip가 차단됩니다. public static DateTime GetDummyDate() { return new DateTime(2017, 12, 24); //to check if we have an online date or not. } public static DateTime GetNISTDate() { System.Random ran = new System.Random(DateTime.Now.Millisecond); DateTime date = GetDummyDate(); string serverResponse = string.Empty; // NIST 서버 목록 string[] servers = new string[] { "time.bora.net", //"time.nuri.net", //"ntp.kornet.net", //"time.kriss.re.kr", //"time.nist.gov", //"maths.kaist.ac.kr", "nist1-ny.ustiming.org", "time-a.nist.gov", "nist1-chi.ustiming.org", "time.nist.gov", "ntp-nist.ldsbc.edu", "nist1-la.ustiming.org" }; // 너무 많은 요청으로 인한 차단을 피하기 위해 한 서버씩 순환한다. 5번만 시도한다. for (int i = 0; i < 5; i++) { try { // StreamReader(무작위 서버) StreamReader reader = new StreamReader(new System.Net.Sockets.TcpClient(servers[ran.Next(0, servers.Length)], 13).GetStream()); serverResponse = reader.ReadToEnd(); reader.Close(); // 서버 리스폰스를 표시한다. (디버그 확인용) if (Debug.isDebugBuild) Debug.Log(serverResponse); // 시그니처가 있는지 확인한다. if (serverResponse.Length > 47 && serverResponse.Substring(38, 9).Equals("UTC(NIST)")) { // 날짜 파싱 int jd = int.Parse(serverResponse.Substring(1, 5)); int yr = int.Parse(serverResponse.Substring(7, 2)); int mo = int.Parse(serverResponse.Substring(10, 2)); int dy = int.Parse(serverResponse.Substring(13, 2)); int hr = int.Parse(serverResponse.Substring(16, 2)); int mm = int.Parse(serverResponse.Substring(19, 2)); int sc = int.Parse(serverResponse.Substring(22, 2)); if (jd > 51544) yr += 2000; else yr += 1999; date = new DateTime(yr, mo, dy, hr, mm, sc); // Exit the loop break; } } catch (Exception e) { /* 아무것도 하지 않고 다음 서버를 시도한다. */ } } return date; } #endregion }
아래 코드 원본에서 주석 변경 및 내가 사용하기 위해 수정함.
경로 : https://stackoverflow.com/questions/516788/getting-current-gmt-time
[펌] Enable Push Notification in XCode project by default? (0) | 2019.06.03 |
---|---|
[펌] animation.sample() usage (0) | 2019.05.09 |
[펌] Async-Await instead of coroutines in Unity 2017 (0) | 2019.02.21 |
[펌] 웹 페이지 상의 이미지를 읽어와 출력하기 (0) | 2018.12.21 |
[펌] Unity C# – Coroutine 알아보기 (0) | 2018.09.07 |