Archive for 7月, 2014

 

unity : c#とphpでmessagepack

7月 30th, 2014

一番シンプルにobject[]のみを利用することにしました。 全部 key, valueのセットで。 c# ( boxingPackerを利用) object[] data = new object[]{ new object[] { “game”, new object[] { new object[]{ “stage”, 1}, new object[]{ “score”, 2} } }, new object[] { “updated”, 123456789 } }; php $data = array( array( “game”, array( array( “stage”, 1), array(“score”, 2 ) ) ), array( “updated”, 123456789 ) […]

Read full article | コメントは受け付けていません。

unity : messagepack

7月 28th, 2014

messagepack http://msgpack.org/ 他の物はunsafeが利用出来なかったり、ビルド手順が必要だったので https://github.com/masharada/msgpack-unity こちらを利用させていただきます。 string test = “unity test”; MsgPack.ObjectPacker bp = new MsgPack.ObjectPacker (); byte[] packed = bp.Pack (test); // print binary Debug.Log (Encoding.Unicode.GetString (packed)); string unpackedText = (string)bp.Unpack(packed); // pring “unity test” Debug.Log(unpackedText); クラスとリスト public class TestData{ public int score; public string playerName; public Dictionary myDict; public TestData( int s, string n […]

Read full article | コメントは受け付けていません。

unity : c# serializable

7月 27th, 2014

クラスをシリアライズするのに[Serializable]が必要です。 クラスをそのまま保存する際に利用します。 ScoreクラスをUserPrefsなどに保存する場合にバイナリシリアライズします。 using System; [Serializable] public class Score { } クラスをインスペクターに表示するのに System.Serializableを使うと と言う話はよくでていますね。

Read full article | コメントは受け付けていません。

unity : admob interstitialインタースティシャル広告を入れてみる。

7月 26th, 2014

プレイ中の一時停止とアプリ終了時に出すようにしてみました。 admobが表示されていれば、interstitial用のIDを作ってサンプル通りです。 https://github.com/googleads/googleads-mobile-plugins https://github.com/googleads/googleads-mobile-plugins/blob/master/unity/samples/HelloWorld/Assets/GoogleMobileAdsDemoScript.cs このままで簡単に全画面広告が表示されます。

Read full article | コメントは受け付けていません。

unity : soomla 一通り使って。

7月 25th, 2014

* アイテム説明に改行を入れてはいけない。ストアもコード内もJSONで処理するところでエラーになる。気付き難い。 * エラーメッセージが詳細でない。ログには出ているが。イベントハンドラーに渡ってこない。 * エラー終了処理がイベントハンドラーで帰って来ないものもある、場合によってタイムアウトチェックする必要がある 正確ではありませんが気になった点はこの辺でした。 githubで頻繁に更新してくれているので、必要な物はリクエストして良いかもしれません。

Read full article | コメントは受け付けていません。

unity : soomla onMarketItemsRefreshStarted

7月 25th, 2014

エラーのときfinishedが呼ばれないので、独自にタイムアウトを設定する必要がある?

Read full article | コメントは受け付けていません。

unity : soomla restoreTransaction リストア処理

7月 25th, 2014

non consumable item がある時、購入済みか確認。 起動時に自動でチェックしてみたら、アカウント、パスワードのリクエストがあるので駄目でした。 (駄目ではないけど購入しない人にとっては邪魔) チェック開始は SoomlaStore.RestoreTransactions (); 開始終了のイベント確認はhandlerの public void onRestoreTransactionsStarted() {} public void onRestoreTransactionsFinished(bool success) {} 内で処理する必要のある物は処理する。

Read full article | コメントは受け付けていません。

unity : シーン名取得

7月 25th, 2014

http://docs.unity3d.com/ScriptReference/Application-loadedLevelName.html Application.loadedLevelName scene.unityのscene部分を取得出来る。

Read full article | コメントは受け付けていません。

unity : soomla & admob iOS 実機テスト

7月 24th, 2014

* Google Mobile Adsは7.0.0になってモジュール化されているので、 * 個別にxcodeにファイル追加は必要はなく。 * unity 用の pluginのclassも修正されているので更新が必要。 * 現時点では、@import 部分のエラーが残っているので * #import の形に修正する。 1. Add the Google Mobile Ads iOS SDK library. https://developers.google.com/mobile-ads-sdk/download?hl=ja#downloadios iOSの 6.10.0 GoogleMobileAdsSdkiOS.zip をダウンロード xcodeの Unity-iPhoneプロジェクトを右クリックして Add files to “Unity-iPhone”で Add ons以外をすべて追加 2. Add the following frameworks if they aren’t already part of the project: AdSupport AudioToolbox AVFoundation CoreGraphics […]

Read full article | コメントは受け付けていません。

unity : googleads-mobile-plugins

7月 24th, 2014

https://github.com/googleads/googleads-mobile-plugins admobをこれで入れてみます。 unity 4.5で動くかな? https://github.com/googleads/googleads-mobile-plugins/releases v2.1 GoogleMobileAds.unitypackage をダウンロードしてimport * androidmanifestが上書きされるので、他の物を利用している場合は差分を確認 https://github.com/googleads/googleads-mobile-plugins/tree/master/unity https://developers.google.com/mobile-ads-sdk/docs/#play ./PATH/android-sdk/tools/android で、google play servicesが入っているか確認 ./SDK/extras/google/google_play_services/libproject/ に google-play-services_lib があるので、それを、unityの Plugins/Android/以下にコピーする 早速バナーを表示してみる。 https://github.com/googleads/googleads-mobile-plugins/tree/master/unity テストIDで表示。 AdRequest request = new AdRequest.Builder() .AddTestDevice(“ここにテストデバイスのID”) .Build(); 一度アプリを実行して ddmsでログを表示すると .AddTestDevice(“ああああああああ”) というログが表示されるのでデバイスのIDを取得出来ます。

Read full article | コメントは受け付けていません。