Esempio n. 1
0
 public void SetSubmission(MatryxSubmission submission)
 {
     if (this.submission == null ||
         this.submission.hash != submission.hash)
     {
         titleText.text = submission.title;
         bodyText.text  = "Loading...";
         ClearPreview();
         DisableImport();
         this.submission = submission;
         MatryxCortex.GetSubmission(submission,
                                    (result) =>
         {
             Submission = (MatryxSubmission)result;
             if (Submission.calcflowCompatible)
             {
                 EnableImport("View");
             }
             else
             {
                 DisableImport("Incompatible");
             }
         },
                                    (err) =>
         {
             bodyText.text = "Something went wrong. :(";
             DisableImport("Uh oh");
         });
     }
 }
Esempio n. 2
0
 public void LoadMySubmissions(MatryxTournament tournament)
 {
     Instance.tournament = tournament;
     infoText.gameObject.SetActive(true);
     infoText.text = "Loading Submissions...";
     ClearSubmissions();
     MatryxCortex.RunGetMySubmissions(tournament, 0, ProcessSubmissions);
 }
Esempio n. 3
0
    public void SetRound(int roundIndex)
    {
        if (Tournament != null)
        {
            ClearSubmissions();

            loadingSubmissions.gameObject.SetActive(true);
            MatryxCortex.RunGetRound(Tournament, roundIndex, ProcessRound);
        }
    }
Esempio n. 4
0
 public bool LoadMyTournaments(int thePage)
 {
     if ((loaded | loading) == true)
     {
         return(false);
     }
     loading = true;
     myTournamentsListText.text = "Loading Tournaments...";
     ClearCommits();
     MatryxCortex.RunGetMyTournaments(0, 0, ProcessTournaments, ShowError);
     return(true);
 }
Esempio n. 5
0
 public bool LoadMyCommits(int thePage)
 {
     if ((loaded | loading) == true)
     {
         return(false);
     }
     userAddress          = NetworkSettings.currentAddress;
     loading              = true;
     commitsListText.text = "Loading Creations...";
     ClearCommits();
     MatryxCortex.RunGetMyCommits(ProcessCommits, ShowError);
     return(true);
 }
Esempio n. 6
0
 public bool LoadTournaments(int thePage, float waitTime = 0)
 {
     if ((loaded | loading) == true)
     {
         return(false);
     }
     loading = true;
     tournamentListText.text      = "Loading Tournaments...";
     tournamentListText.fontStyle = TMPro.FontStyles.Normal;
     ClearTournaments();
     MatryxCortex.RunGetTournaments(thePage, waitTime, ProcessTournaments, ShowError);
     return(true);
 }
Esempio n. 7
0
    public void SetCommit(string commitHash)
    {
        if (commitHash.Equals(""))
        {
            parentCommitButton.transform.parent.gameObject.SetActive(false);
        }
        else
        {
            parentCommitButton.transform.parent.gameObject.SetActive(true);
        }

        this.commit      = new MatryxCommit(commitHash);
        title.text       = "Commit " + commit.hash.Substring(0, 10);
        description.text = "Content: \n\n";
        importButton.Disable();
        MatryxCortex.RunGetCommit(commit.hash, true, UpdateDisplay, ErrorGettingCommit);
    }
Esempio n. 8
0
    public void SetTournament(MatryxTournament theTournament)
    {
        if (Tournament == null || Tournament.address != theTournament.address || userAddress != NetworkSettings.currentAddress)
        {
            ClearSubmissions();
            centerButton.transform.parent.gameObject.SetActive(false);
            // Show us something at least
            PreprocessTournament(theTournament);
            userAddress = NetworkSettings.currentAddress;

            loadingSubmissions.gameObject.SetActive(true);
            MatryxCortex.RunGetMySubmissions(Tournament, 0, ProcessMySubmissions);
            MatryxCortex.RunGetTournament(Tournament.address, true, ProcessTournament, ErrorLoadingTournament);
        }
        else
        {
            centerButton.updateState();
        }
    }
Esempio n. 9
0
    public void SetCommit(MatryxCommit commit)
    {
        if (commit == null)
        {
            parentCommitButton.transform.parent.gameObject.SetActive(false);
        }
        else
        {
            parentCommitButton.transform.parent.gameObject.SetActive(true);
        }

        this.commit = commit;
        title.text  = "Commit " + commit.hash.Substring(0, 10);
        var datetime = TimeZoneInfo.ConvertTime(Utils.Time.FromUnixTime((double)commit.timestamp), TimeZoneInfo.Local);

        creationDate.text = datetime.ToShortDateString() + ", " + datetime.ToLongTimeString();
        description.text  = "Content: \n\n";
        creator.text      = "by " + Utils.Accounts.ellipseAddress(commit.owner);
        importButton.Disable();
        MatryxCortex.RunGetCommit(commit.hash, true, UpdateDisplay, ErrorGettingCommit);
    }
Esempio n. 10
0
 public void RefreshText()
 {
     MatryxCortex.GetMTXBalance((bal) => { accountInfoText.text = "Current:\n" + NetworkSettings.currentAddress + "\n\n Balance: " + bal + "MTX"; });
 }
Esempio n. 11
0
    private void LookupCommitStateByExpressionSet(object sender, EventArgs args)
    {
        ClaimCommitButton.Instance.SetState(ClaimCommitButton.CommitButtonState.Disabled);

        var surface = SerializeSurface();

        Debug.Log("surface: " + surface);
        if (lastSurface.Equals(surface))
        {
            return;
        }
        if (!MatryxCommit.storageClaimsLoaded)
        {
            return;
        }

        List <string> fileNames = new List <string> {
            "jsonContent.json"
        };
        List <string> contents = new List <string> {
            surface
        };
        // get ipfs hash
        var ipfsHashRequest = new Utils.CoroutineWithData <string>(MatryxCortex.Instance, MatryxCortex.uploadFiles(fileNames, contents, "&only-hash=true",
                                                                                                                   (object multiHash) =>
        {
            // This correct? You should look at commits that've already been created and see if there is one with this hash
            string ipfsHash = multiHash as string;

            bool commitExists = MatryxCommit.commits.ContainsKey(ipfsHash);
            bool claimExists  = MatryxCommit.claims.ContainsKey(ipfsHash);

            if (claimExists && !commitExists)
            {
                ClaimCommitButton.Instance.commit = new MatryxCommit(ipfsHash, surface);
                ClaimCommitButton.Instance.SetState(ClaimCommitButton.CommitButtonState.YetToBeCommitted);
            }
            else if (commitExists)
            {
                if (MatryxCommit.commits[ipfsHash].mine)
                {
                    ClaimCommitButton.Instance.SetState(ClaimCommitButton.CommitButtonState.Committed);
                }
                else
                {
                    ClaimCommitButton.Instance.SetState(ClaimCommitButton.CommitButtonState.CantCommit);
                }

                ClaimCommitButton.Instance.commit = MatryxCommit.commits[ipfsHash];
            }
            else
            {
                ClaimCommitButton.Instance.commit = new MatryxCommit(ipfsHash, surface);
                ClaimCommitButton.Instance.SetState(ClaimCommitButton.CommitButtonState.YetToBeClaimed);
            }
        }));
    }
Esempio n. 12
0
 public void ReloadSubmissions(float waitTime = 0)
 {
     ClearSubmissions();
     MatryxCortex.RunGetMySubmissions(Tournament, waitTime, ProcessMySubmissions);
 }