Ejemplo n.º 1
0
 public void InformationLevel1()
 {
     if (totalFunds >= 500)
     {
         gameObject.GetComponent <Plague>().insideChance  *= 0.8f;
         gameObject.GetComponent <Plague>().outsideChance *= 0.8f;
         totalFunds -= 500;
         I2.SetActive(true);
         MT2.SetActive(true);
     }
 }
Ejemplo n.º 2
0
 public void VaccineLevel1()
 {
     if (totalFunds >= 500)
     {
         totalFunds         -= 500;
         vaccinesPerSec      = 100;
         readyToSentVaccines = true;
         VAC2.SetActive(true);
         MT2.SetActive(true);
     }
 }
        public frmReincarnationMaterialEditor(MaterialItem mi, Material M)
        {
            InitializeComponent();

            cboBaseMaterial.SelectedIndex = 15;

            parent   = mi;
            material = (M.SupportingDocuments["Source"] as MT2);

            setMaterial(material);
            pbPreview.Image = M.Texture.GetThumbnail(256);
        }
Ejemplo n.º 4
0
 public void MoneyLevel1()
 {
     if (totalFunds >= 500)
     {
         if (passiveIncome == 10)
         {
             passiveIncome += 20;
             totalFunds    -= 500;
             MB2.SetActive(true);
             MT2.SetActive(true);
         }
     }
 }
        private void setMaterial(MT2 m)
        {
            lstSamplersAndTexCoordSources.Items.Clear();

            txtMaterialName.Text = m.Name;
            cboBaseMaterial.Text = m.BasedOffOf;

            setUIFromObject(m.Defaults);
            setUIFromObject(m);

            foreach (Sampler sampler in m.Defaults.Samplers)
            {
            }
        }
Ejemplo n.º 6
0
        private void setMaterial(MT2 m)
        {
            lstSamplersAndTexCoordSources.Items.Clear();

            txtMaterialName.Text = m.Name;
            cboBaseMaterial.Text = m.BasedOffOf;

            setUIFromObject((MT2)Activator.CreateInstance(m.GetType()));
            setUIFromObject(m);

            //foreach (Sampler sampler in m.Defaults.Samplers)
            //{
            //}
        }
Ejemplo n.º 7
0
        public override Asset Import(string path)
        {
            Material material;

            string name = Path.GetFileNameWithoutExtension(path);

            ToxicRagers.Generics.Material m = null;

            switch (Path.GetExtension(path).ToLower())
            {
            case ".mt2":
                m = MT2.Load(path);
                break;

            case ".mtl":
                m = MTL.Load(path);
                break;
            }

            if (m != null)
            {
                var    mat      = (m as MT2);
                string fileName = (mat != null ? mat.Texture : (m as MTL).Textures[0]);

                if (fileName == null || fileName == "")
                {
                    material = new Material {
                        Name = name, Texture = new Texture()
                        {
                            Name = fileName
                        }
                    };
                }
                else
                {
                    material = new Material {
                        Name = name, Texture = SceneManager.Current.Content.Load <Texture, TDXImporter>(fileName, Path.GetDirectoryName(path))
                    };
                }

                material.SupportingDocuments["Source"] = m;
            }
            else
            {
                material = new Material();
            }

            return(material);
        }
Ejemplo n.º 8
0
        public MaterialEditor(Material M)
        {
            InitializeComponent();

            cboBaseMaterial.SelectedIndex = 15;

            if (M.SupportingDocuments.ContainsKey("Source") && M.SupportingDocuments["Source"] is MT2 m)
            {
                material = m;

                setMaterial(material);
            }

            if (M.Texture != null)
            {
                pbPreview.Image = M.Texture.GetThumbnail(256);
            }
        }
Ejemplo n.º 9
0
        public override Asset Import(string path)
        {
            string   name     = Path.GetFileNameWithoutExtension(path);
            Material material = new Material {
                Name = name
            };

            MT2 mat = MT2.Load(path);

            foreach (string file in mat.FileNames)
            {
                material.Texture = SceneManager.Current.Content.Load <Texture, TDXImporter>(file, Path.GetDirectoryName(path));
            }

            material.SupportingDocuments["Source"] = mat;

            return(material);
        }
        private void setUIFromObject(MT2 m)
        {
            foreach (var property in m.GetType().GetProperties())
            {
                if (property.CanRead)
                {
                    object[] attributes = property.GetCustomAttributes(true);
                    bool     bRequired  = attributes.Any(a => a.GetType() == typeof(Required));

                    switch (property.PropertyType.ToString().Split('.').Last())
                    {
                    case "Vector3":
                        break;

                    case "Single":
                        NumericUpDown nud = (this.Controls.Find("nud" + property.Name, true).FirstOrDefault() as NumericUpDown);
                        if (nud == null)
                        {
                            nud = (NumericUpDown)controlWithTag(property.Name, this).First();
                        }
                        nud.Value = (Decimal)(Single)property.GetValue(m, null);
                        break;

                    case "Troolean":
                    {
                        CheckBox chk = (this.Controls.Find("chk" + property.Name, true).FirstOrDefault() as CheckBox);
                        if (chk == null)
                        {
                            chk = chkNoSortAlpha;
                        }
                        Troolean value = (Troolean)property.GetValue(m, null);
                        if (value != Troolean.Unset)
                        {
                            chk.Checked = (value == Troolean.True);
                        }
                    }
                    break;

                    case "String":
                    {
                        TextBox txt = (this.Controls.Find("txt" + property.Name, true).FirstOrDefault() as TextBox);
                        if (txt == null)
                        {
                            txt = (TextBox)controlWithTag(property.Name, this).FirstOrDefault();
                        }
                        if (txt == null)
                        {
                            Console.WriteLine("Couldn't find txt{0}", property.Name);
                            continue;
                        }

                        txt.Text = (string)property.GetValue(m, null);
                        setTextBoxState(txt);
                    }
                    break;

                    default:
                        Console.WriteLine("[{2}] {0} = {1}", property.Name, property.GetValue(m, null), property.PropertyType.ToString());
                        break;
                    }
                }
            }
        }