using FlatBuffers;
using ;
using ;
using ;
using UnityEngine;
using ;
public class FlatBuffersTest : MonoBehaviour
{
public class Monster
{
public Vector3 pos;
public short hp;
public string name;
}
public monster;
public Text text;
private Monster _monster = new Monster();
private void Awake()
{
LoadFlatBuffersFile(, "/MyGame");
//StartCoroutine(GetMyGameData());
}
void LoadFlatBuffersFile(string configDir, string strFileName)
{
string configPath = configDir + strFileName + ".bin";
if (!(configPath))
{
("File no exists! Path:" + configPath);
return;
}
var data = (configPath);
var bb = new ByteBuffer(data);
monster = (bb);
_monster.pos = new Vector3(, , );
_monster.hp = ;
_monster.name = ;
= string.Format("当前的血量是:{0}HP,名字是:{1},位置是{2}", _monster.hp, _monster.name, _monster.pos);
}
IEnumerator GetMyGameData()
{
WWW www = new WWW( + "/");
yield return www;//等待Web服务器的反应
if ( != null)
{
();
yield return null;
}
var bb = new ByteBuffer();
monster = (bb);
var pos = new Vector3(, , );
= string.Format("当前的血量是:{0}HP,名字是:{1},位置是{2}", , , pos);
}
}