コード例 #1
0
    public void GetCurrentStateOnly()
    {
        string cmdstr = "{\"jsonrpc\":\"2.0\", \"method\":\"getcurrentstate\", \"id\":0}";

        StartCoroutine(shipsdRpcCommand(cmdstr, (status) => {
            //JObject jsonObject = JObject.Parse(status);
            //print(status);
            try
            {
                retStatusJson ret = JsonConvert.DeserializeObject <retStatusJson>(status);
                //Debug.Log("getstate:" + ret.result.height + " hash" + ret.result.blockhash);
                //Debug.Log(ret.result.blockhash);
                GlobalData.gblockhash      = ret.result.blockhash;
                GlobalData.gblockHeight    = ret.result.height;
                GlobalData.gblockStatusStr = ret.result.state;
                bCurrentLive = true;
                SetGameSateFromJson(status);
            }
            catch (System.Exception e)
            {
                //bCurrentLive = false;
                print(e.ToString());
            }
        }));
    }
コード例 #2
0
    public void GetCurrentStateAndWaiting()
    {
        string cmdstr = "{\"jsonrpc\":\"2.0\", \"method\":\"getcurrentstate\", \"id\":0}";

        StartCoroutine(shipsdRpcCommand(cmdstr, (status) => {
            //JObject jsonObject = JObject.Parse(status);
            retStatusJson ret = JsonConvert.DeserializeObject <retStatusJson>(status);

            //Debug.Log(ret.result.blockhash);
            GlobalData.gblockhash      = ret.result.blockhash;
            GlobalData.gblockHeight    = ret.result.height;
            GlobalData.gblockStatusStr = ret.result.state;
            SetGameSateFromJson(status);
            WaitChange(GlobalData.gblockhash);
        }));
    }