Example #1
0
 public void Gototitle()
 {
     PlayerPrefs.SetInt("character", 0);
     PlayerPrefs.SetInt("job", 0);
     Datamanager.i().stage   = 0;
     Datamanager.i().shd     = 0;
     Datamanager.i().str     = 0;
     Datamanager.i().agi     = 0;
     Datamanager.i().maxmana = 3;
     Datamanager.i().insnum  = 0;
     Datamanager.i().ins     = false;
     Datamanager.i().genamr  = false;
     Datamanager.i().gennum  = 0;
     Datamanager.i().r       = false;
     Datamanager.i().rnum    = 0;
     Datamanager.i().w       = false;
     Datamanager.i().wnum    = 0;
     Datamanager.i().l       = false;
     Datamanager.i().lnum    = 0;
     Datamanager.i().d       = false;
     Datamanager.i().dnum    = 0;
     Datamanager.i().b       = false;
     Datamanager.i().bnum    = 0;
     Deckmanager.instance().Removedeck();
     SceneManager.LoadScene("1_Title");
     Datamanager.i().curscore = 0;
 }
Example #2
0
    public void Addreward(string btnname, int val)
    {
        UIGrid     g = GetComponentInChildren <UIGrid>();
        GameObject b = Instantiate(btn);

        b.name = btnname;
        b.GetComponent <Rewardbtninfo>().val = val;
        switch (btnname)
        {
        case "gold":
            b.GetComponentInChildren <UILabel>().text = val + "gold";
            break;

        case "card":
            b.GetComponentInChildren <UILabel>().text = Deckmanager.instance().Returnname(val);
            break;

        case "treasure":
            b.GetComponentInChildren <UILabel>().text = Itemmanager.instance().Returnname(val);
            GameObject t = Instantiate(trea);
            t.GetComponentInChildren <UILabel>().enabled  = false;
            t.GetComponentInChildren <UIButton>().enabled = false;
            t.transform.parent        = b.transform;
            t.transform.localPosition = new Vector3(-190, 5, 0);
            Seticon(t, val);
            break;
        }
        b.transform.parent     = g.gameObject.transform;
        b.transform.localScale = new Vector3(1, 1, 1);
        g.enabled = true;
        rewardlist.Add(b);
    }
Example #3
0
 void Returndeck()
 {
     for (int i = viewlist.Count - 1; i > -1; i--)
     {
         Deckmanager.instance().orideck.Add(viewlist[i]);
         viewlist[i].transform.parent        = Deckmanager.instance().gameObject.transform;
         viewlist[i].transform.localScale    = new Vector3(1, 1, 1);
         viewlist[i].transform.localPosition = Vector3.zero;
         viewlist[i].SetActive(false);
         viewlist.Remove(viewlist[i]);
     }
 }
Example #4
0
 void Copydeck()
 {
     for (int i = Deckmanager.instance().orideck.Count - 1; i > -1; i--)
     {
         viewlist.Add(Deckmanager.instance().orideck[i]);
         Deckmanager.instance().orideck[i].transform.parent        = cardlist.GetComponentInChildren <UIGrid>().gameObject.transform;
         Deckmanager.instance().orideck[i].transform.localPosition = Vector3.zero;
         Deckmanager.instance().orideck[i].transform.localScale    = new Vector3(1, 1, 1);
         Deckmanager.instance().orideck[i].GetComponent <Usecard>().mana.SetActive(true);
         Deckmanager.instance().orideck[i].SetActive(true);
         Deckmanager.instance().orideck.Remove(Deckmanager.instance().orideck[i]);
         cardlist.GetComponentInChildren <UIGrid>().enabled = true;
     }
 }
Example #5
0
 void Classcard()
 {
     for (int i = Deckmanager.instance().orideck.Count - 1; i > -1; i--)
     {
         if (Deckmanager.instance().orideck[i].GetComponent <Cardstat>().up == false)
         {
             reinlist.Add(Deckmanager.instance().orideck[i]);
             Deckmanager.instance().orideck[i].transform.parent        = cardlist.GetComponentInChildren <UIGrid>().gameObject.transform;
             Deckmanager.instance().orideck[i].transform.localPosition = Vector3.zero;
             Deckmanager.instance().orideck[i].transform.localScale    = new Vector3(1, 1, 1);
             Deckmanager.instance().orideck[i].SetActive(true);
             Deckmanager.instance().orideck.Remove(Deckmanager.instance().orideck[i]);
             cardlist.GetComponentInChildren <UIGrid>().enabled = true;
         }
     }
 }
Example #6
0
 public void Acceptbtn()
 {
     Effectmanager.i().Startsfx(36);
     Deckmanager.instance().Plus(target);
     for (int i = reinlist.Count - 1; i > -1; i--)
     {
         Deckmanager.instance().orideck.Add(reinlist[i]);
         reinlist[i].transform.parent        = Deckmanager.instance().gameObject.transform;
         reinlist[i].transform.localScale    = new Vector3(1, 1, 1);
         reinlist[i].transform.localPosition = Vector3.zero;
         reinlist[i].SetActive(false);
         reinlist.Remove(reinlist[i]);
     }
     yesno.SetActive(false);
     cardlist.SetActive(false);
     gameObject.SetActive(false);
 }
Example #7
0
 public void Buycard(GameObject card)
 {
     if (Application.loadedLevelName != "Store")
     {
         return;
     }
     if (card.GetComponent <Cardstat>().gold > Datamanager.i().gold)
     {
         return;
     }
     card.transform.parent = Deckmanager.instance().gameObject.transform;
     Deckmanager.instance().orideck.Add(card);
     card.transform.localScale    = new Vector3(1, 1, 1);
     card.transform.localPosition = Vector3.zero;
     Datamanager.i().gold -= card.GetComponent <Cardstat>().gold;
     goldlabel.enabled = false;
     card.SetActive(false);
 }
Example #8
0
    public void Onclick()
    {
        switch (gameObject.name)
        {
        case "gold":
            Datamanager.i().gold += val;
            Effectmanager.i().Startsfx(35);
            break;

        case "card":
            Deckmanager.instance().Createcard(val);
            break;

        case "treasure":
            Itemmanager.instance().Itemcreate(val);
            break;
        }
        gameObject.SetActive(false);
    }
Example #9
0
 public void Copydeck()
 {
     for (int i = 0; i < Deckmanager.instance().orideck.Count; i++)
     {
         GameObject c;
         c = Instantiate(card);
         c.GetComponentInChildren <BoxCollider>().enabled = false;
         c.GetComponent <Usecard>().gy = GameObject.Find("Graveyard");
         Deckmanager.instance().Copystat(Deckmanager.instance().orideck[i], c);
         c.transform.parent               = deckgrid.transform;
         c.transform.localScale           = new Vector3(0.5f, 0.5f, 0.5f);
         c.GetComponent <UIPanel>().depth = 2;
         c.GetComponent <Usecard>().mana.SetActive(false);
         c.GetComponent <Usecard>().back.enabled = true;
         deck.Add(c);
     }
     GameObject.Find("Cardinfo").SetActive(false);
     StartCoroutine(Startturn());
 }
Example #10
0
 public void SendBoardScore()
 {
     Social.Active.ReportScore(Datamanager.i().curscore, "CgkIqdPV8NIREAIQAg", (bool success) =>
     {
         if (success == true)
         {
             Datamanager.i().stage   = 0;
             Datamanager.i().shd     = 0;
             Datamanager.i().str     = 0;
             Datamanager.i().agi     = 0;
             Datamanager.i().maxmana = 3;
             Datamanager.i().insnum  = 0;
             Datamanager.i().ins     = false;
             Datamanager.i().genamr  = false;
             Datamanager.i().gennum  = 0;
             Datamanager.i().r       = false;
             Datamanager.i().rnum    = 0;
             Datamanager.i().w       = false;
             Datamanager.i().wnum    = 0;
             Datamanager.i().l       = false;
             Datamanager.i().lnum    = 0;
             Datamanager.i().d       = false;
             Datamanager.i().dnum    = 0;
             Datamanager.i().b       = false;
             Datamanager.i().bnum    = 0;
             Deckmanager.instance().Removedeck();
             Datamanager.i().curscore = 0;
             ShowLeaderBoard();
             Itemmanager.instance().Removeinven();
             SceneManager.LoadScene("1_Title");
         }
         else
         {
         }
     });
 }
Example #11
0
    public void Loadgame()
    {
        PlayerPrefs.SetInt("character", PlayerPrefs.GetInt("job"));
        switch (PlayerPrefs.GetInt("character"))
        {
        case 1:
            Datamanager.i().maxhp = 120;
            break;

        case 2:
            Datamanager.i().maxhp = 100;
            break;
        }
        Datamanager.i().stage    = PlayerPrefs.GetInt("stage");
        Datamanager.i().gold     = PlayerPrefs.GetInt("gold");
        Datamanager.i().curhp    = PlayerPrefs.GetInt("hp");
        Datamanager.i().curscore = PlayerPrefs.GetInt("score");
        Datamanager.i().maxmana  = 3;
        Datamanager.i().save     = true;
        Deckmanager.instance().Loaddeck();
        Itemmanager.instance().Loaditem();
        PlayerPrefs.SetInt("job", 0);
        SceneManager.LoadScene(2);
    }
Example #12
0
 void Createshop()
 {
     for (int i = 0; i < 3; i++)
     {
         int        j = Random.Range(1, 9);
         GameObject c = Instantiate(card);
         Deckmanager.instance().Givestat(j, c);
         c.transform.parent                           = cardg.gameObject.transform;
         c.transform.localScale                       = new Vector3(.8f, .8f, .8f);
         c.GetComponent <Cardstat>().gold             = Random.Range(30, 50);
         c.GetComponentInChildren <UILabel>().enabled = true;
         c.GetComponentInChildren <UILabel>().text    = "" + c.GetComponent <Cardstat>().gold;
         cardg.enabled = true;
     }
     for (int i = 0; i < 2; i++)
     {
         int        j = Random.Range(10, 16);
         GameObject c = Instantiate(card);
         Deckmanager.instance().Givestat(j, c);
         c.transform.parent                           = cardg.gameObject.transform;
         c.transform.localScale                       = new Vector3(.8f, .8f, .8f);
         c.GetComponent <Cardstat>().gold             = Random.Range(70, 110);
         c.GetComponentInChildren <UILabel>().enabled = true;
         c.GetComponentInChildren <UILabel>().text    = "" + c.GetComponent <Cardstat>().gold;
         cardg.enabled = true;
     }
     for (int i = 0; i < 1; i++)
     {
         int        j = Random.Range(16, 20);
         GameObject c = Instantiate(card);
         Deckmanager.instance().Givestat(j, c);
         c.transform.parent                           = cardg.gameObject.transform;
         c.transform.localScale                       = new Vector3(.8f, .8f, .8f);
         c.GetComponent <Cardstat>().gold             = Random.Range(130, 170);
         c.GetComponentInChildren <UILabel>().enabled = true;
         c.GetComponentInChildren <UILabel>().text    = "" + c.GetComponent <Cardstat>().gold;
         cardg.enabled = true;
     }
     for (int i = 0; i < 2; i++)
     {
         int        j = Random.Range(0, 2);
         GameObject t = Instantiate(item);
         Itemmanager.instance().Itemstat(j, t);
         t.GetComponent <BoxCollider>().enabled = true;
         t.transform.parent                           = itemg.gameObject.transform;
         t.transform.localScale                       = new Vector3(1, 1, 1);
         t.GetComponent <Iteminfo>().gold             = Random.Range(150, 190);
         t.GetComponentInChildren <UILabel>().enabled = true;
         t.GetComponentInChildren <UILabel>().text    = "" + t.GetComponent <Iteminfo>().gold;
         print(j);
         Seticon(t, j);
         itemg.enabled = true;
     }
     for (int i = 0; i < 1; i++)
     {
         int        j = Random.Range(2, 4);
         GameObject t = Instantiate(item);
         Itemmanager.instance().Itemstat(j, t);
         t.GetComponent <BoxCollider>().enabled = true;
         t.transform.parent                           = itemg.gameObject.transform;
         t.transform.localScale                       = new Vector3(1, 1, 1);
         t.GetComponent <Iteminfo>().gold             = Random.Range(250, 300);
         t.GetComponentInChildren <UILabel>().enabled = true;
         t.GetComponentInChildren <UILabel>().text    = "" + t.GetComponent <Iteminfo>().gold;
         print(j);
         Seticon(t, j);
         itemg.enabled = true;
     }
 }
Example #13
0
 public void Decide()
 {
     PlayerPrefs.SetInt("character", selchar);
     Deckmanager.instance().Starterdeck();
     Letsclimb();
 }