'분류 전체보기'에 해당되는 글 495건

  1. 2014.08.08 baas.io 유니티 유저 정보 입력 및 받아오기.
  2. 2014.08.07 안드로이드 gcm 관련 php 통신.
  3. 2014.08.05 안드로이드 유효성 검사하기 AsyncTask..
  4. 2014.08.04 c++ 책을 샀습니다.
  5. 2014.07.30 공부하고 싶은 것들 정리.(구글킵)
  6. 2014.07.24 c# 표준 코딩 규칙
  7. 2014.07.22 카메라 부드럽게 움직이는 스크립트
  8. 2014.07.07 [펌][ Unity3D ] 모바일(안드로이드) 파일생성 및 읽고 쓰기 Unity3D
  9. 2014.07.07 에셋번들 관련 글 및 링크 모음
  10. 2014.07.02 유니티 3.5.7 버전 설치하기.

baas.io 유니티 유저 정보 입력 및 받아오기.

|

post 방식으로 전달할때는 json 파일로 전달하기 위해서 json 파서가 필요함.

litjson 이나 minijson 등 자기가 편한 파서를 사용하자.

여기서는 minijson.cs 파일을 이용해서 파서를 함.


MiniJSON.cs






Trackback 0 And Comment 0

안드로이드 gcm 관련 php 통신.

|

대강

할건 없고. 오픈소스 프로젝트의 프로젝트대로 소스 복붙하고

자기 자신의 regid 알아낸다음에 아래에 입력해주고

노티피케이션이 실행되는지만 하면 됨.


상용화될 게임에는 regid 등록해주는 부분에서 각 DB 에 regid 등록해주고

아래 php 구문을 DB에 접속해서 DB의 regid 를 모두 호출해주는 식으로 수정해주면 될거같음.

일단 확실히 되는 php 구문임..


   <?php
        // Replace with real server API key from Google APIs        
        // 서버api Key 입력

        $apiKey = "";
      
        // Replace with real client registration IDs
        // 각 핸드폰 기계의 registraitionID 입력.

        $registrationIDs = array(
        " ",

  " ",

        );
      
        // Message to be sent

        // 입력하고 싶은 메시지 입력
        $message = "Test Notificación PHP";
      
        // Set POST variables
        $url = 'https://android.googleapis.com/gcm/send';
      
        $fields = array(
            'registration_ids' => $registrationIDs,
            'data' => array( "message" => $message ),
        );
      
        $headers = array(
            'Authorization: key=' . $apiKey,
            'Content-Type: application/json'
        );
      
        // Open connection
        $ch = curl_init();
      
        // Set the url, number of POST vars, POST data
        curl_setopt( $ch, CURLOPT_URL, $url );
        curl_setopt( $ch, CURLOPT_POST, true );
        curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );      
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode( $fields ));
      
        // Execute post
        $result = curl_exec($ch);      
        // Close connection
        curl_close($ch);
        echo $result;
    ?>

Trackback 0 And Comment 0

안드로이드 유효성 검사하기 AsyncTask..

|


일단 대강 이런식으로 처리 해주면 될거같음..


 IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener() {
        public void onIabPurchaseFinished(IabResult result, Purchase purchase) {

.

.

.    


  verifyPayloadTask task = new verifyPayloadTask();
            task.execute(purchase);

}

}


class verifyPayloadTask extends AsyncTask<Purchase, Void, Void> {
        boolean isVerify = false;
        Purchase purchase;
        @Override
        protected Void doInBackground(Purchase... params) {
            // TODO Auto-generated method stub
            //오류시 null 반환
            Log.d(TAG, "verifypaylaod doinBackground!");
            isVerify = true;
            purchase = params[0];
            return null;
        }

        protected void onPostExecute(Void voids) {
            Log.d(TAG,"verifyPayloadTask onPostExecute");
            if(isVerify){
                Log.d(TAG, "Purchase successful.");

                if (purchase.getSku().equals(SKU_GAS)) {
                    // bought 1/4 tank of gas. So consume it.
                    Log.d(TAG, "Purchase is gas. Starting gas consumption.");
                    mHelper.consumeAsync(purchase, mConsumeFinishedListener);
                }
            }
        }
    }

Trackback 0 And Comment 0

c++ 책을 샀습니다.

|

기존에 c++ 관련 책은 윤성우 저자의 열혈강의 c++ 밖에 가지고 있지 않았는데, 이번에 

성안당의 c++ 기초 플러스를 구입했습니다. 엄청난 양의 책 두께를 자랑한다고 하네요.

어쨌든 c++ 공부를 열심히 해야겠다는 생각을 했으니.. 열심히 하겠습니다.


'잡다한것들전부 > C, C++, C#' 카테고리의 다른 글

구글 c# 코딩 규칙  (0) 2015.04.27
컴퓨터 16진법 표시  (0) 2014.08.29
c++ 책을 샀습니다.  (0) 2014.08.04
c# 표준 코딩 규칙  (0) 2014.07.24
c언어 공부할때 참고 사이트  (0) 2014.01.15
[펌]C언어 자료구조 - 연결리스트(Linked List)  (0) 2014.01.13
Trackback 0 And Comment 0

공부하고 싶은 것들 정리.(구글킵)

|

공부방향


이펙티브 시리즈나
혹은 해골,용책 정도 밖에 생각이 나질 않아서요
물리책도 보고, AI책도 보고 그러는거죠.
리펙토링도 해보고 설계도 해보세요.
공룡책 한번 보세요. OS 에 관한책입니다.
국어, 수학, 물리, 영어
디자인패턴이나 리팩토링 Code Complete 뭐 이런 류의 책

C++(1학년): try-catch,template,다형성
데이터구조론(2학년): tree, hash, sort
데이터베이스(3학년): 제2정규화, stored procedure
운영체제론(3학년): Operating System Concepts (이른바 공룡책)의 "프로세스" 챕터
컴퓨터네트워크(3학년): OSI 3-4 level, ARQ 알고리즘
컴파일러(4학년): BNF grammar
정보보호(4학년): RSA, AES, DES

http://www.hanmadiro.com/ -무료영어
http://www.ebsi.co.kr/ebs/pot/potg/retrieveCourseH3TeacherInfo.ebs?teacherId=@*ebsint_e68&targetCode=D200
영어
http://www.ebsi.co.kr/ebs/pot/potg/retrieveCourseH3TeacherInfo.ebs?teacherId=@*09st-m02&targetCode=D300
수학

1. Direct 3D 엔진 개발을 위한 루트로, 고 기술력이 요구되는 방향의 진로
2. 게임 브리오, 언리얼등 유명 게임 엔진 유경험을 쌓아 보편적인 3D 게임 개발자로의 진로

MS SQL은
뇌를 자극하는 SQL Server 2008 - 한빛미디어






c++ 서적


- c++ 기초 플러스
- effetive c++





c# 스프라이트 툴 만들기


http://cafe.naver.com/jzsdn/25183






게임샐러드 관련 강좌


http://diyga.me/
http://blog.naver.com/hellofskill
게임샐러드책은 국내에 한권뿐

Trackback 0 And Comment 0

c# 표준 코딩 규칙

|

http://www.scribd.com/doc/163870946/C-%EC%BD%94%EB%94%A9-%ED%91%9C%EC%A4%80%EA%B3%BC-%EC%A2%8B%EC%9D%80-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D-%EC%8A%B5%EA%B4%80

Trackback 0 And Comment 0

카메라 부드럽게 움직이는 스크립트

|




static float SmoothDamp(float current, float target, float currentVelocity, float smoothTime, float maxSpeed = Mathf.Infinity, float deltaTime = Time.deltaTime);

Parameters

currentThe current position.
targetThe position we are trying to reach.
currentVelocityThe current velocity, this value is modified by the function every time you call it.
smoothTimeApproximately the time it will take to reach the target. A smaller value will reach the target faster.
maxSpeedOptionally allows you to clamp the maximum speed.
deltaTimeThe time since the last call to this function. By default Time.deltaTime.

시간내(smoothTime)에 정해진 목표(target)로 이동한다.(반환값)

이동할때의 속도도 currentVelocity 값으로 알수있다.(ref 로 넘겨줌)

Trackback 0 And Comment 0

[펌][ Unity3D ] 모바일(안드로이드) 파일생성 및 읽고 쓰기 Unity3D

|

2013/01/21 11:48

복사 http://blog.naver.com/nameisljk/110157303742

전용뷰어 보기

작업하던 도중 모바일에선 경로가 파일경로가 바뀌고 읽어오지못하는 문제가 발생하였다.

pc에선 잘되지만 모바일에서만 이상이있었음

찾다 찾다 유니티 포럼에서 좋은거 긁어왔습니다. ㅋㅋ 아이폰도 됩니다~

 

 

public void writeStringToFile( string str, string filename )
{
#if !WEB_BUILD
string path = pathForDocumentsFile( filename );
FileStream file = new FileStream (path, FileMode.Create, FileAccess.Write);

StreamWriter sw = new StreamWriter( file );
sw.WriteLine( str );

sw.Close();
file.Close();
#endif
}


public string readStringFromFile( string filename)//, int lineIndex )
{
#if !WEB_BUILD
string path = pathForDocumentsFile( filename );

if (File.Exists(path))
{
FileStream file = new FileStream (path, FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader( file );

string str = null;
str = sr.ReadLine ();

sr.Close();
file.Close();

return str;
}

else
{
return null;
}
#else
return null;
#endif 
}

// 파일쓰고 읽는넘보다 이놈이 핵심이죠
public string pathForDocumentsFile( string filename ) 

if (Application.platform == RuntimePlatform.IPhonePlayer)
{
string path = Application.dataPath.Substring( 0, Application.dataPath.Length - 5 );
path = path.Substring( 0, path.LastIndexOf( '/' ) );
return Path.Combine( Path.Combine( path, "Documents" ), filename );
}

else if(Application.platform == RuntimePlatform.Android)
{
string path = Application.persistentDataPath;
path = path.Substring(0, path.LastIndexOf( '/' ) );
return Path.Combine (path, filename);
}

else 
{
string path = Application.dataPath;
path = path.Substring(0, path.LastIndexOf( '/' ) );
return Path.Combine (path, filename);
}
}


Trackback 0 And Comment 0

에셋번들 관련 글 및 링크 모음

|

에셋번들 예제


http://u3d.as/1qS








에셋번들 관련 글



파일에 쓰는법


var cache = new System.IO.FileStream( 저장할 경로 , System.IO.FileMode.Create);
cache.Write(download.bytes, 0, download.bytes.Length);
cache.Close();




조금은 하드코딩이 되겠지만요 ^^;
제가 사용한 방법을 예를 들자면 에셋에서 그림파일을 불러온후
그것을 PNG로 변환 설정한후에 byte[]형으로 변환해서
FileStream을 사용해 Write해주는 방식으로 처리 했어요.



다른 한가지 방법으로는 zip를 이용해서 다운로드 한후 압축을 풀어 사용하는 방법도 있습니다.
전 요즘엔 이 방법을 더 많이 쓰는것 같군요 ^^;


zip 파일로 다운로드를 만든 경우에는 Object로 불러 오신후 그것을
(GameObject)Instantiate(불러온 오브젝트, 좌표, Quaternion회전) 등으로 사용할 수 있을듯 합니다.
테스트는 안해 봤어요 ^^;;







어셋 번들 만들기~
    public static string[] GetAssetNameList()

    {

        string[] assetName =

        {

            "assets/resources/object/mobobject/n2010_wolf/face/n2010f01.png",

            "assets/resources/object/mobobject/n2010_wolf/n2010.png",
             .....
        };
        m_strAssetNameList = assetName;

        return assetName;

    }
 
    [MenuItem("Assets/Build AssetBundles - Windows")]

    public static void BuildAssetWindows()

    {

        string[] assetName = AssetBundleModule.GetAssetNameList();
        Object[] asset = new Object[assetName.Length];

        for (int i = 0; i < assetName.Length; ++i)

        {

            asset[i] = AssetDatabase.LoadMainAssetAtPath(assetName[i]);

            assetName[i] = Regex.Replace(assetName[i], @"(?i)Assets/Resources/", "");

            assetName[i] = assetName[i].Remove(assetName[i].LastIndexOf("."));

            Debug.Log(assetName[i]);

        }
        Debug.Log("Make AssetBundle totalcount: " + assetName.Length.ToString());
        BuildPipeline.BuildAssetBundleExplicitAssetNames(asset, assetName, AssetBundleModule.GetAssetPrefixName() + "Windows" + AssetBundleModule.GetAssetPostfixName(), BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets, BuildTarget.StandaloneWindows);

    }
 
어셋 번들 로드하기~~
        if (m_bUseCache == true)

        {

            string assetPath = GetAssetBundleWebURL();

            Debug.Log(assetPath);

            m_WWW = WWW.LoadFromCacheOrDownload(assetPath, m_nAssetBundleVersion);

        }

        else

        {

            string assetPath = GetAssetBundlePath();

            Debug.Log(assetPath);

            m_WWW = new WWW(assetPath);

        }
 
로드다되면
        m_AssetBundle = m_WWW.assetBundle;

        m_WWW.Dispose();

        m_WWW = null;
 
어셋 찾아서 쓰기
            UnityEngine.Object findObject = m_AssetBundle.Load(name, type);

            if (findObject == null)

            {

                Debug.Log("FindAssetName not exists object : " + name + " / type : " + type.ToString());

            }

            return findObject;
 





http://botta.tistory.com/38 이 사이트를 참고하셔서 만들어보세요~ 그리고

    public IEnumerator OnLoadAssetBundle()
    {
        m_WWW = new WWW("file://" + Application.dataPath + "/../" + "애셋번들");
     
        yield return m_WWW;

        m_AssetBundle = m_WWW.assetBundle;

        m_WWW.Dispose();

        m_WWW = null;
       
       
        Texture m_Tex1 = (Texture)m_AssetBundle.Load("CFa0.png", typeof(Texture));
       

    }





C#을 기준으로 설명 드릴께요.
먼저 변수선언으로
int _gender = 0;
int _job = 0;
Texture2D _texture = null;
AssetBundle _assetBundle = null;
를 주시고,
함수 한개를 만들어서

IEnumerator gameHeroImageLoad (int argGender, int argJob) {
WWW _www = new WWW("file://" + "디렉토리와 파일명");
yield return _www;

_assetBundle = _www.assetBundle;
string _tmpHeroImageName = argGender + "-" + argJob + "-Texture";
if (_assetBundle.Gontains(_tmpHeroImageName)) {
_texture = (Texture2D)_assetBundle.Load(_tmpHeroImageName);
}
}

Update () 에서 특정 조건일때 위에 함수를 불러 오게되면 _texture에
이미지가 들어 가겠죠.
그후 OnGUI ()에서 _texture가 null일때와 아닐때의 표시 부분을 바꿔 주시면 될듯 합니다.
단 한가지 주의할 점은 그래픽을 다른 그래픽으로 바꾸시고 싶으시다면,
void deleteGameObject () {
_texture = null;
_assetBundle.Unload(true);
_assetBundle = null;
}
이 함수를 부르신 후에 다시 gameHeroImageLoad를 불러와 주시면 됩니다.
번들을 만들때는 이름에 주의 하셔서 성별-직업-Texture와 같이 png파일을 저장해 주시면 될 것 같습니다.
그냥 머리속의 프로그램을 적는 거니 버그가 있을 수 있습니다.










에셋번들 관련 링크


api


http://docs.unity3d.com/ScriptReference/AssetBundle.html


menual


http://docs.unity3d.com/Manual/AssetBundlesIntro.html



Trackback 0 And Comment 0

유니티 3.5.7 버전 설치하기.

|

2014 년에 3.5버전을 사용하려고 하니 없는 자료들이 많다.

안된다.. 뭔짓을 해도 안된다.


그냥 따라하자

무조건


32비트로 무조건 다운받자 프로그램들은..


1. jdk 1.6 버전 설치

일단 JDK 를 다운받자 

1.6 버전으로 다운받아야 된다.


http://ghaffarian.net/downloads/Java/JDK/




2. Andorid SDK 설치


일단 SDK 를 다운받자. 32비트로


http://developer.android.com/sdk/index.html


sdk Manager을 열어보면 tools 에서 17버전을 다운받을수있는데 다운받고 난후


build-tools 폴더에 17.0.0 파일들을 platform-tools폴더에 복사




3. Android sdk r20 버전 설치후 tools 폴더 교체

22이후부터 apkbuilder.bat 파일이 없다고 합니다.


구글링 하니 rev.22 버젼에서 없어졌다고 하네요.
rev.20 수동으로 받아서 넣으니 있네요. 유니티 컴파일중에 이파일 없다고 빌드 안되서 당황
했네요. rev.20 버젼 필요하신분은 

http://dl-ssl.google.com/android/repository/tools_r20-windows.zip
에서 받으셔서 기존 tools 백업 해놓으시고 교체 하시면 됩니다.


Trackback 0 And Comment 0
prev | 1 | ··· | 6 | 7 | 8 | 9 | 10 | 11 | 12 | ··· | 50 | next