Beispiel #1
0
 protected void OnApplicationQuit()
 {
     StatisticsTracking.InstantEvent("Average Size", gameObject.name, new Dictionary <string, object>()
     {
         { "Size", average }
     });
 }
Beispiel #2
0
    public bool CompileAll()
    {
        bool isValid = true;

        foreach (string RO in ranges.Keys)
        {
            solver.SetGlobalVariable(RO, -666);
            ranges[RO].Min.compileTokens();
            expValidity[RO] = ranges[RO].Min.GenerateAKSolver(solver);
            ranges[RO].Max.compileTokens();
            expValidity[RO] &= ranges[RO].Max.GenerateAKSolver(solver);
            isValid         &= expValidity[RO];
        }
        foreach (string EX in expressions.Keys)
        {
            expressions[EX].compileTokens();
            expValidity[EX.ToString()] = expressions[EX].GenerateAKSolver(solver);
            isValid &= expValidity[EX.ToString()];
        }
        StatisticsTracking.InstantEvent("Expression Value", "Value Updated", new Dictionary <string, object>()
        {
            { "valid", isValid }
        });
        return(isValid);
    }
Beispiel #3
0
    public void LoadSavedExpressionSets(List <ExpressionSet> expressionSets)
    {
        List <ExpressionSet> ess = new List <ExpressionSet>();

        for (int i = 0; i < expressionSets.Count; i++)
        {
            ess.Add(expressionSets[i].DeepCopy());
            ess[ess.Count - 1].CompileAll();
        }

        //var expression = new Dictionary<string, object>();
        var expressionString = "";

        foreach (var es in ess)
        {
            foreach (var e in es.expressions)
            {
                expressionString += e.Value.AKExpression.ToString() + "\n";
            }
        }
        //expression["expression"] = expressionString;
        StatisticsTracking.InstantEvent("Load Expression", expressionString);

        paramSurface.expressionSets = ess;
        pieceWiseControl.ForceNumberOfTabs(ess.Count);
        expressionSet = paramSurface.expressionSets[0];
        calcInput.ChangeOutput(expressionSet.expressions["X"]);
        if (boundsManager != null)
        {
            boundsManager.UpdateButtonText();
        }
        inputReceived = true;
    }
Beispiel #4
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     StatisticsTracking.InstantEvent("Average Size", gameObject.name, new Dictionary <string, object>()
     {
         { "Size", average }
     });
 }
Beispiel #5
0
 protected override void FixedUpdate()
 {
     base.FixedUpdate();
     if (count == uint.MaxValue)
     {
         count = 1;
         StatisticsTracking.InstantEvent("Average Size", gameObject.name, new Dictionary <string, object>()
         {
             { "Size", average }
         });
     }
     if (skipCount++ >= skip)
     {
         skipCount = 0;
         float weight = 1f / count;
         average = (average + transform.localScale * weight) / (1 + weight);
         count++;
     }
 }
Beispiel #6
0
        IEnumerator InitRoutine()
        {
            // instantiate platform contract
            using (WWW www = new WWW(latestPlatformInfoEndpt))
            {
                yield return(www);

                var jsonObj = serializer.Deserialize <object>(www.bytes) as Dictionary <string, object>;

                var platformAbi = Encoding.UTF8.GetString(serializer.Serialize(jsonObj["abi"]));
                platformAddress  = jsonObj["address"] as string;
                platformContract = new Contract(null, platformAbi, platformAddress);
            }

            // instantiate token contract
            using (WWW www2 = new WWW(latestTokenInfoEndpt))
            {
                yield return(www2);

                var tokenJsonObj = serializer.Deserialize <object>(www2.bytes) as Dictionary <string, object>;
                var tokenAddress = tokenJsonObj["address"] as string;

                var tokenAbi = Encoding.UTF8.GetString(serializer.Serialize(tokenJsonObj["abi"]));
                tokenContract = new Contract(null, tokenAbi, tokenAddress);
            }

            // instantiate tournament contract (without address)
            using (WWW www3 = new WWW(latestTournamentAbiEndpt))
            {
                yield return(www3);

                var tournyJsonObj = serializer.Deserialize <object>(www3.bytes) as Dictionary <string, object>;
                tournamentAbi = Encoding.UTF8.GetString(serializer.Serialize(tournyJsonObj["abi"]));
                //var tournamentAbi = Encoding.UTF8.GetString(serializer.Serialize(tournyJsonObj["abi"]));
            }

            // Get accounts
            var requestAccounts = new EthAccountsUnityRequest(mtxNode);

            yield return(requestAccounts.SendRequest());

            var resultsAccounts = requestAccounts.Result;

            if (resultsAccounts != null && resultsAccounts[0] != null)
            {
                StatisticsTracking.InstantEvent("Matryx Init", "Eth Node", new Dictionary <string, object>()
                {
                    { "Node Found", true },
                });

                var usedAccount = resultsAccounts[0];
                Debug.Log("Used account:" + usedAccount);
                var function         = platformContract.GetFunction("prepareBalance");
                var transactionInput = function.CreateTransactionInput(usedAccount, (long)42);
                transactionInput.Gas = new HexBigInteger(3000000);
                // Do request
                var requestTransaction = new EthSendTransactionUnityRequest(customRPCNode);
                yield return(requestTransaction.SendRequest(transactionInput));

                var resultsTransaction = requestTransaction.Result;
            }
            else
            {
                StatisticsTracking.InstantEvent("Matryx Init", "Eth Node", new Dictionary <string, object>()
                {
                    { "Node Found", false },
                });
            }
        }