Esempio n. 1
0
    public void SpawnSecrets()
    {
        foreach (Transform child in lineItemTransform)
        {
            Destroy(child.gameObject);
        }
        List <NotSecretLineItem> lineItems = new List <NotSecretLineItem>();

        foreach (var secret in FlagRepository.instance.secretFlags.secrets)
        {
            //Debug.Log("secret.secret.ToString(): "+secret.secret.ToString());
            if (FlagRepository.ReadSecretKey(secret.secret.ToString()) != 0)               //If the secret has been discovered
            {
                GameObject        newGO             = Instantiate(lineItemPrefab, lineItemTransform, false);
                NotSecretLineItem notSecretLineItem = newGO.GetComponent <NotSecretLineItem>();
                notSecretLineItem.Unpack(secret);
                lineItems.Add(notSecretLineItem);
            }
        }
        //Move Stricken items to the bottom of the list
        foreach (var item in lineItems)
        {
            if (item.isStricken)
            {
                item.gameObject.transform.SetAsLastSibling();
            }
        }
    }
Esempio n. 2
0
 public void Unpack(NotSecretData nsData /*, NotSecrets _NotSecrets*/)
 {
     //notSecretsRef = _NotSecrets;
     notSecretData = nsData;
     myText        = nsData.text;
     isStricken    = FlagRepository.ReadSecretKey(notSecretData.secret.ToString()) == 2; //2 is stricken
     TextSetStricken();
     myRect.sizeDelta = new Vector2(myRect.sizeDelta.x, text.preferredHeight);
 }
Esempio n. 3
0
    public void OnPointerClick(PointerEventData eventData)
    {
        int strikeState = FlagRepository.ReadSecretKey(notSecretData.secret.ToString());

        if (strikeState == 1)
        {
            isStricken = true;
            FlagRepository.SecretKeyStrike(notSecretData.secret.ToString());
            transform.SetAsLastSibling();
        }
        else
        {
            isStricken = false;
            FlagRepository.WriteSecretKey(notSecretData.secret.ToString(), 1);
        }
        TextSetStricken();
    }
Esempio n. 4
0
 public void CheckConditions()
 {
     isUsable = true;
     if (items.Count > 0)
     {
         foreach (var item in items)
         {
             if (!Inventory.instance.InventoryHas(item.name))
             {
                 isUsable = false;
                 break;
             }
         }
     }
     if (quests.Count > 0)
     {
         foreach (var quest in quests)
         {
             if (!FlagRepository.ReadQuestKey(quest.ToString()))
             {
                 isUsable = false;
                 break;
             }
         }
     }
     if (secrets.Count > 0)
     {
         foreach (var secret in secrets)
         {
             if (FlagRepository.ReadSecretKey(secret.ToString()) < 1)   //Secret hasn't been found
             {
                 isUsable = false;
                 break;
             }
         }
     }
     outline.color = isUsable ? colorOpen : colorLocked;
 }