Exemplo n.º 1
0
    public void FromJson(BonDocument json)
    {
        foreach (BonElement p in json)
        {
            switch (p.name)
            {
            case "dlcType": {
                dlcType = (DLCType)p.value.AsInt;
                break;
            }

            case "files": {
                foreach (BonElement pp in p.value.AsBonDocument)
                {
                    FileDesc fd = new FileDesc();
                    fd.name        = pp.name;
                    fd.pak         = this;
                    files[fd.name] = fd;
                    fd.FromJson(pp.value.AsBonDocument);
                }
                break;
            }

            case "dependences": {
                BonArray arr = p.value.AsBonArray;
                dependences = new string[arr.Count];
                for (int i = dependences.Length; --i >= 0;)
                {
                    dependences[i] = arr[i].AsString;
                }
                break;
            }
            }
        }
    }
Exemplo n.º 2
0
 public DotData(string ht, DLCType dt, OnType ot, string position)
 {
     this.position = position;
     type          = ht;
     dtype         = dt.ToString();
     otype         = ot.ToString();
 }
Exemplo n.º 3
0
 public static string GetDirectory(HeroType ht, DLCType dt)
 {
     if (dt == DLCType.HORIZONTAL)
     {
         return("Pieces/" + getName(ht) + " Row");
     }
     else if (dt == DLCType.VERTICAL)
     {
         return("Pieces/" + getName(ht) + " Column");
     }
     else if (dt == DLCType.ADJACENT)
     {
         return("Pieces/" + getName(ht) + " Adjacent");
     }
     else if (dt == DLCType.BOMB)
     {
         return("Pieces/" + getName(ht) + " Bomb");
     }
     else
     {
         if (ht != HeroType.CONCRETE)
         {
             return("Pieces/" + getName(ht) + " Piece");
         }
         else
         {
             return("Pieces/" + getName(ht));
         }
     }
 }
Exemplo n.º 4
0
    public Counter(HeroType ht)
    {
        this.ht = ht;
        string s = TypeUtils.getName(ht).Replace(" ", "");

        if (ContentManager.data == null)
        {
            ContentManager.data = Saver.load();
        }

        string  data = (string)ContentManager.data.GetType().GetField(ht.ToString().ToLower()).GetValue(ContentManager.data);
        DLCType?type = getType(data);

        if (type != null)
        {
            working   = true;
            this.type = (DLCType)type;
            Sprite sprite = Dot.typeToSprite(ht, this.type);

            go1 = GameObject.FindGameObjectWithTag(s);
            go2 = GameObject.FindGameObjectWithTag(s + "Bar");

            Image img = go1.GetComponent <Image>();
            img.color  = new Color(1f, 1f, 1f, 0.4f);
            img.sprite = sprite;

            Image img2 = go2.GetComponent <Image>();
            img2.color  = new Color(1f, 1f, 1f, 1f);
            img2.sprite = sprite;
        }
    }
Exemplo n.º 5
0
    public static void SelectItem(DLCType dt)
    {
        string s;

        if (dt == DLCType.NONE)
        {
            s = "";
        }
        else
        {
            s = dt.ToString();
        }

        FieldInfo f   = ContentManager.data.GetType().GetField(selected.ToString().ToLower());
        string    ds  = (string)f.GetValue(ContentManager.data);
        DLCType?  odt = TypeUtils.getDType(ds);

        if (odt == null && ds == "")
        {
            odt = DLCType.NONE;
        }

        if (odt != null && dict.ContainsKey((DLCType)odt))
        {
            foreach (Transform t in dict[(DLCType)odt].transform)
            {
                if (t.name == "Takeoff")
                {
                    t.gameObject.SetActive(false);
                }
                else if (t.name == "Puton")
                {
                    t.gameObject.SetActive(true);
                }
            }
        }

        if (dict.ContainsKey(dt))
        {
            foreach (Transform t in dict[dt].transform)
            {
                if (t.name == "Takeoff" && dt != DLCType.NONE)
                {
                    t.gameObject.SetActive(true);
                }
                else if (t.name == "Puton")
                {
                    t.gameObject.SetActive(false);
                }
            }
        }

        f.SetValue(ContentManager.data, s);
        Saver.save(ContentManager.data);
        UpdateIcons();
    }
Exemplo n.º 6
0
        public static Bitmap getImage(HeroType ht, DLCType dt)
        {
            try
            {
                return(imgs[new KeyValuePair <HeroType, DLCType>(ht, dt)]);
            }
            catch (Exception e) { }

            return(null);
        }
Exemplo n.º 7
0
 public void setType(HeroType ht, bool adjacent)
 {
     sr.sprite = Dot.typeToSprite(ht, dt);
     if (adjacent)
     {
         this.cacheht = this.ht;
         this.cachedt = this.dt;
     }
     this.ht = ht;
     this.dt = DLCType.NONE;
 }
Exemplo n.º 8
0
    public static void BuyItem(DLCType dt2)
    {
        string s = ShopManager.selected.ToString() + ":" + ((DLCType)dt2).ToString();

        if (ContentManager.data.purchases.Contains(s))
        {
            return;
        }
        if (ContentManager.data.coins < getPrice(dt2))
        {
            return;
        }

        ContentManager.data.purchases.Add(s);
        ContentManager.data.coins -= getPrice(dt2);
        Saver.save(ContentManager.data);
        Bars.update();

        foreach (Transform child in dict[dt2].transform)
        {
            if (child.name == "Buy")
            {
                child.gameObject.SetActive(false);
            }
            else if (child.name == "Puton")
            {
                child.gameObject.SetActive(true);
            }
        }

        foreach (DLCType dt in Enum.GetValues(typeof(DLCType)).Cast <DLCType>())
        {
            foreach (Transform child in dict[dt].transform)
            {
                if (child.name == "Buy" && (ContentManager.data.purchases.Contains(selected.ToString() + ":" + dt.ToString()) || dt == DLCType.NONE || ContentManager.data.coins < getPrice(dt)))
                {
                    child.gameObject.SetActive(false);
                }
                else if (child.name == "Nuy")
                {
                    child.gameObject.SetActive(true);
                }

                if (child.name == "NotEnoughMoney" && (ContentManager.data.purchases.Contains(selected.ToString() + ":" + dt.ToString()) || dt == DLCType.NONE || ContentManager.data.coins >= getPrice(dt)))
                {
                    child.gameObject.SetActive(false);
                }
                else if (child.name == "NotEnoughMoney")
                {
                    child.gameObject.SetActive(true);
                }
            }
        }
    }
Exemplo n.º 9
0
        private void dot_MouseMove(object sender, MouseEventArgs e)
        {
            try
            {
                Point   p = PointToClient(Cursor.Position);
                Control c = GetChildAtPoint(p);
                if (c == null || !(c is PictureBox))
                {
                    return;
                }
                string[] s = ((PictureBox)c).Name.Split('y');
                s[0] = s[0].Replace("x", "");
                Dot d = dots[s[0] + ":" + s[1]];
                if (d.getBox().BorderStyle != BorderStyle.FixedSingle)
                {
                    select(d);
                }
                if (!selecting)
                {
                    return;
                }

                HeroType ht = hts[(string)typeBox.Items[typeBox.SelectedIndex]];
                DLCType  dt = (DLCType)getDTypeByInt(dlcBox.SelectedIndex);
                OnType   ot = (OnType)getOTypeByInt(onBox.SelectedIndex);
                if (d.getHType() != ht)
                {
                    d.setHType(ht);
                }
                if (d.getDType() != dt)
                {
                    d.setDType(dt);
                }
                if (ons.ContainsKey(d) && ot == OnType.NONE)
                {
                    ons[d].destroy();
                    ons.Remove(d);
                }
                else if (!ons.ContainsKey(d) && ot != OnType.NONE)
                {
                    ons.Add(d, new On(d, ot));
                }
                else if (ons.ContainsKey(d) && ons[d].getOType() != ot)
                {
                    ons[d].setOType(ot);
                }
            }
            catch (Exception ex) { }
        }
Exemplo n.º 10
0
 bool DLCPredicateFast(
     DLCManager.DLCInfo a,
     DLCType dlcType,
     string[] words)
 {
     if (dlcType != DLCType.None)
     {
         if (a.DLCType != dlcType)
         {
             return(false);
         }
     }
     if (words != null && words.Length > 0)
     {
         if (!LoadOrderWindow.ContainsWords(a.Text, words))
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 11
0
    private static int getPrice(DLCType dt)
    {
        switch (dt)
        {
        case DLCType.VERTICAL:
            return(100);

        case DLCType.HORIZONTAL:
            return(150);

        case DLCType.ADJACENT:
            return(200);

        case DLCType.BOMB:
            return(300);

        case DLCType.NONE:
            return(0);
        }

        return(0);
    }
Exemplo n.º 12
0
 public DLCInfoAttribute(string text, DLCType type)
 {
     Text = text;
     Type = type;
 }
Exemplo n.º 13
0
 public void setDLCType(DLCType dt)
 {
     this.dt   = dt;
     sr.sprite = typeToSprite(ht, dt);
 }
Exemplo n.º 14
0
 public static Sprite typeToSprite(HeroType ht, DLCType dt)
 {
     return(Board.rs.sprites[new System.Collections.Generic.KeyValuePair <HeroType, DLCType>(ht, dt)]);
 }
Exemplo n.º 15
0
 public void setDType(DLCType n)
 {
     this.dt = n;
     updateImage();
 }
Exemplo n.º 16
0
 public string getName(DLCType dt)
 {
     return(getName(dt.ToString()));
 }