본문 바로가기

Programming

(89)
파일) Line단위로 쓰기 public void MakeFile (List _stringListA, string _fname) { string a_filePath = GetFilePath (_fname); FileStream a_fstrem = new FileStream (a_filePath, FileMode.Create, FileAccess.Write); StreamWriter a_sw = new StreamWriter (a_fstrem); ---- ---- for (int i = 0; i < _stringListA.Count; i++) { a_sw.WriteLine (_stringListA [i]); } a_sw.Close (); a_fstrem.Close (); }
파일) Path string GetFilePath (string _fname) { string _path = ""; if (Application.platform == RuntimePlatform.Android) { _path = Application.persistentDataPath; _path = _path.Substring (0, _path.LastIndexOf ('/')); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { _path = Application.dataPath.Substring (0, Application.dataPath.Length - 5); _path = _path.Substring (0, _path.LastIndexOf ('/..
문자열) 숫자에 , (콤마) 넣기 public string InsertComma (string _string, int offset = 0) { int _length = _string.Length; string _endInitial = ""; ---- ---- if (_length >= 10 - offset && _length = 13 - offset && _length = 16 - offset && _length 0){ for (int _stringIndex = _length-1; _stringIndex >= 0 ; _stringIndex--) { if (_index%3 == 0 && _index != _length) { _string = _string.Insert(_stringIndex, ","); } _index++; } } if (..
스파인 애니메이션 셋팅값 설정 파랗게 표시한 부분을 0으로 설정한다. 기본적으로 0.2로 셋팅되어있다.
UGUI - text 글자길이에 맞게 Recttransform 크기 변경하기 (recttransform resize as text length) Recttransform m_Text_Recttransform; Text m_Text; m_Text.string = "asfsafsdfasdfsa"; m_Text_Recttransfrom.sizeDelta = new Vector2 (m_Text.preferredWith, m_Text.preferredHeight);
c# 타임스템프 사용하기 using system; TimeSpan m_LocalTime = DateTime.Now.ToLocalTime() - new DateTime (1970, 1, 1, 0, 0, 0, 0).ToLocalTime (); ulong _DiffTime = receivedTime - (ulong)m_LocalTime.TotalSeconds; float _timeTick = 0; void Update () { _timeTick += Time.deltaTime; if (_timeTick >= 1) { _DiffTime--; } }
c# 숫자앞에 0 넣기 int a_hour = (int)(_time / 3600); int a_min = (int)_time % 3600 / 60; int a_sec = (int)_time % 3600 % 60; string.Format ("{0:D2} : {1:D2} : {2:D2}", a_hour, a_min, a_sec); => 01:59:06
animator 사용시 play함수 사용법 animator ani; 1) ani.Play("애니메이션이름"); => 같은 애니메이션을 반복시 애니메이션을 중간에 끊지 못하고 기다려야한다. 2) ani.Play("애니메이션이름, -1, 0); => 같은 애니메이션을 반복시 중간에 끊고 다시 시작할수있다. 유니티 (Unity) Animator로 2d Animation 재생(Play) 목표 animator를 이용하여 간단하게 반복적인 Idle 움직임과 외부에서 클릭 시 점프하는 animation을 구현하여 여러 개의 애니메이션이 한 번에 재생되는 상황을 연출해 보겠습니다. 목차 1. 결과화면 moblieandlife.tistory.com 유니티(Unity) 애드몹 부업 프로젝트 : [1] 시작 목표 아주 단순한 점프게임을 만들어서 광고를 붙이고 광고수..