Exemplo n.º 1
0
    void Start()
    {
        GeneScriptableObject = Resources.Load <GenePopupCreator>("ScriptableObjects/" + SceneManager.GetActiveScene().name);
        ObjectiveTime        = GeneScriptableObject.objectiveTimeSeconds;
        Score1Star           = GeneScriptableObject.score1Star;
        Score2Stars          = GeneScriptableObject.score2Stars;
        Score3Stars          = GeneScriptableObject.score3Stars;

        lvlNameTextUi.text = GeneScriptableObject.geneName;

        currentCombinationPlayed = PlayerPrefs.GetString("CombinationPlay");
        //CurrentGene = int.Parse(SceneManager.GetActiveScene().name.Replace("Gene", ""));
        ExonCount         = GameObject.FindGameObjectsWithTag("Exon").Length;
        IntronCount       = GameObject.FindGameObjectsWithTag("Huge Intron").Length + GameObject.FindGameObjectsWithTag("Large Intron").Length + GameObject.FindGameObjectsWithTag("Medium Intron").Length + GameObject.FindGameObjectsWithTag("Small Intron").Length;
        UtrCount          = GameObject.FindGameObjectsWithTag("Utr").Length;
        SnpCount          = GameObject.FindGameObjectsWithTag("Snp").Length;
        LevelLength       = ExonCount + IntronCount + UtrCount + SnpCount;
        SuperVariantCount = GameObject.FindGameObjectsWithTag("SuperVariante").Length;

        AvatarName = PlayerPrefs.GetString("AvatarName");
        PlayerPrefs.SetString("GeneName", GeneScriptableObject.geneName);
        GeneName = GeneScriptableObject.geneName;

        // Sending Analytics event
        Analytics.CustomEvent("level_started", new Dictionary <string, object>
        {
            { "avatar", "Avatar " + AvatarName },
            { "gene", GeneName }
        }
                              );
    }
Exemplo n.º 2
0
 public void SeePopup(Text geneName)
 {
     GetComponent <Transform>().gameObject.SetActive(false);
     if (geneName.text == "FOXO3" && transform.parent.gameObject.name == "Avatar25")
     {
         scriptableObject = Resources.Load <GenePopupCreator>("ScriptableObjects/FOXO3Alternate") as GenePopupCreator;
     }
     else
     {
         scriptableObject = Resources.Load <GenePopupCreator>("ScriptableObjects/" + geneName.text) as GenePopupCreator;
     }
     genePopupDisplay              = avatarsPopup.GetComponent <GenePopupDisplay>();
     genePopupDisplay.activeGene   = scriptableObject;
     genePopupDisplay.AvatarToShow = GetComponent <Transform>().gameObject;
     avatarsPopup.SetActive(true);
 }
    private void OnEnable()
    {
        gene = this.GetComponent <GenePopupDisplay>().activeGene;

        if (!gene.publication1Title.Equals(""))
        {
            Publication1.SetActive(true);
            Publication1.GetComponent <Text>().text = " • " + gene.publication1Title;
            Publication1.GetComponent <Button>().onClick.AddListener(() => {
                Application.OpenURL(gene.publication1Link);
            });
        }
        if (!gene.publication2Title.Equals(""))
        {
            Publication2.SetActive(true);
            Publication2.GetComponent <Text>().text = " • " + gene.publication2Title;
            Publication2.GetComponent <Button>().onClick.AddListener(() => {
                Application.OpenURL(gene.publication2Link);
            });
        }
    }
Exemplo n.º 4
0
    private void Awake()
    {
        activeGene = GameObject.Find("LevelManager").GetComponent <LevelProperties>().GeneScriptableObject;

        if (activeGene == null || activeGene.geneName == null || activeGene.geneName.Equals(""))
        {
            GeneTermine.SetArg("no infos", 0);
        }
        else
        {
            GeneTermine.SetArg(activeGene.geneName, 0);
        }
        ProteinLength.SetArg(activeGene.proteinLength, 0);
        setAllText(GeneName, activeGene.geneFullName);
        setAllText(SnpVariant, activeGene.snp);
        Population.PhraseName = activeGene.population;
        if (SceneManager.GetActiveScene().name.ToLower() == "foxo3alternate")
        {
            Description.PhraseName = "gene-foxo3-text";
        }
        else
        {
            Description.PhraseName = "gene-" + SceneManager.GetActiveScene().name.ToLower() + "-text";
        }


        SnpPresented.SetArg(activeGene.snpName, 0);
        TranscriptLinks.SetArg(activeGene.transcript, 0);
        TranscriptLinks.GetComponent <TextLinks>().Link = activeGene.transcriptLink;

        if (!activeGene.publication1Title.Equals(""))
        {
            Publication1.SetActive(true);
            Publication1.GetComponent <Text>().text = " • " + activeGene.publication1Title;
            Publication1.GetComponent <Button>().onClick.AddListener(() => {
                Application.OpenURL(activeGene.publication1Link);
            });
        }

        if (!activeGene.publication2Title.Equals(""))
        {
            Publication2.SetActive(true);
            Publication2.GetComponent <Text>().text = " • " + activeGene.publication2Title;
            Publication2.GetComponent <Button>().onClick.AddListener(() => {
                Application.OpenURL(activeGene.publication1Link);
            });
        }

        if (!activeGene.chromosomeLink.Equals("") && activeGene.chromosomeLink != null)
        {
            ChromoWalkLogo.SetActive(true);
            ChromoWalkLogo.GetComponent <LogoLinks>().SetLink(activeGene.chromosomeLink);
        }
        else
        {
            ChromoWalkLogo.SetActive(false);
        }

        if (!activeGene.nextprotLink.Equals("") && activeGene.nextprotLink != null)
        {
            NextProtLogo.SetActive(true);
            NextProtLogo.GetComponent <LogoLinks>().SetLink(activeGene.nextprotLink);
        }
        else
        {
            NextProtLogo.SetActive(false);
        }

        if (!activeGene.pubmedLink.Equals("") && activeGene.pubmedLink != null)
        {
            PubmedLogo.SetActive(true);
            PubmedLogo.GetComponent <LogoLinks>().SetLink(activeGene.pubmedLink);
        }
        else
        {
            PubmedLogo.SetActive(false);
        }

        if (!activeGene.pubmedLink2.Equals("") && activeGene.pubmedLink2 != null)
        {
            PubmedLogo2.SetActive(true);
            PubmedLogo2.GetComponent <LogoLinks>().SetLink(activeGene.pubmedLink2);
        }
        else
        {
            PubmedLogo2.SetActive(false);
        }

        if (!activeGene.uniprotLink.Equals("") && activeGene.uniprotLink != null)
        {
            UniprotLogo.SetActive(true);
            UniprotLogo.GetComponent <LogoLinks>().SetLink(activeGene.uniprotLink);
        }
        else
        {
            UniprotLogo.SetActive(false);
        }

        if (!activeGene.snpediaLink.Equals("") && activeGene.snpediaLink != null)
        {
            SNPediaLogo.SetActive(true);
            SNPediaLogo.GetComponent <LogoLinks>().SetLink(activeGene.snpediaLink);
        }
        else
        {
            SNPediaLogo.SetActive(false);
        }

        if (RateBox.Instance.Statistics.DialogIsRated == false && (PlayerPrefs.GetInt("gamesPlayedWithoutRating") % PlayerPrefs.GetInt("incrementRateCTA") == 0) && PlayerPrefs.GetInt("gamesPlayedWithoutRating") != 0)
        {
            RateBox.Instance.Show();
            PlayerPrefs.SetInt("gamesPlayedWithoutRating", 0);
            if (PlayerPrefs.GetInt("incrementRateCTA") < 16)
            {
                PlayerPrefs.SetInt("incrementRateCTA", PlayerPrefs.GetInt("incrementRateCTA") + 4); // TO MODIFY FOR REFRESH RATE OF AD
            }
            else
            {
                PlayerPrefs.SetInt("incrementRateCTA", 16);
            }
        }
        else if (RateBox.Instance.Statistics.DialogIsRated == false)
        {
            int increment = PlayerPrefs.GetInt("gamesPlayedWithoutRating");
            PlayerPrefs.SetInt("gamesPlayedWithoutRating", increment + 1);
        }
    }