public void UpdateMaterials()
        {
            try
            {
                lock (MaterialList)
                {
                    MaterialList.Clear();
                    List <CastSpellAction> castSpellList =
                        CastSpellAction.GetCastSpellActionList(CurrentProfile.Branch);
                    if (castSpellList != null)
                    {
                        foreach (CastSpellAction ca in castSpellList)
                        {
                            if (ca.IsRecipe)
                            {
                                foreach (var ingred in ca.Recipe.Ingredients)
                                {
                                    MaterialList[ingred.ID] = MaterialList.ContainsKey(ingred.ID) ?
                                                              MaterialList[ingred.ID] + (ca.CalculatedRepeat > 0 ?
                                                                                         (int)ingred.Required * (ca.CalculatedRepeat - ca.Casted) : 0) :

                                                              (ca.CalculatedRepeat > 0 ? (int)ingred.Required * (ca.CalculatedRepeat - ca.Casted) : 0);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            { Err(ex.ToString()); }
        }
 public void RefreshOnContentChange()
 {
     ImageList.Clear();
     MaterialList.Clear();
     LoadImageList();
     LoadMaterials();
     RaisePropertyChanged("ImageList");
     RaisePropertyChanged("MaterialList");
 }
Beispiel #3
0
        private void GetMaterials()
        {
            MaterialList.Clear();
            MaterialList.Add("Default2D");
            var materialList = service.GetAllContentNamesByType(ContentType.Material);

            foreach (var material in materialList.Where(material => MaterialHasColor(material)))
            {
                MaterialList.Add(material);                 //ncrunch: no coverage
            }
        }
Beispiel #4
0
        public void FillMaterialList()
        {
            MaterialList.Clear();
            var materialList = editorService.GetAllContentNamesByType(ContentType.Material);

            foreach (var material in
                     materialList.Where(ControlMaterialChanger.TryAddMaterial))
            {
                MaterialList.Add(material);
            }
        }
        private void LoadMaterials()
        {
            MaterialList.Clear();
            var foundmaterials = service.GetAllContentNamesByType(ContentType.Material);

            foreach (var material in foundmaterials)
            {
                MaterialList.Add(material);
            }
            RaisePropertyChanged("MaterialList");
        }
Beispiel #6
0
        private async Task Restore()
        {
            using (DataBaseHelper dbh = new DataBaseHelper())
            {
                var res = await dbh.GetElements <Material>(Tables.MaterialTable, Tables.MaterialFields);

                MaterialList.Clear();
                foreach (var stock in res)
                {
                    MaterialList.Add(stock);
                }
            }
        }
Beispiel #7
0
 public virtual void Clear()
 {
     Header.ElementFormat.Ver      = 2.1f;
     Header.ElementFormat.UVACount = 0;
     ModelInfo.Clear();
     VertexList.Clear();
     FaceList.Clear();
     MaterialList.Clear();
     BoneList.Clear();
     MorphList.Clear();
     BodyList.Clear();
     JointList.Clear();
     SoftBodyList.Clear();
     InitializeSystemNode();
     FilePath     = "";
     LoadErrCount = 0;
 }
Beispiel #8
0
 public void UpdateMaterials()
 {
     if (!_init)
     {
         return;
     }
     try
     {
         lock (MaterialList)
         {
             MaterialList.Clear();
             List <CastSpellAction> castSpellList =
                 CastSpellAction.GetCastSpellActionList(PbBehavior);
             if (castSpellList != null)
             {
                 foreach (CastSpellAction ca in castSpellList)
                 {
                     if (ca.IsRecipe && ca.RepeatType != CastSpellAction.RepeatCalculationType.Craftable)
                     {
                         foreach (Ingredient ingred in ca.Recipe.Ingredients)
                         {
                             MaterialList[ingred.ID] = MaterialList.ContainsKey(ingred.ID)
                                                           ? MaterialList[ingred.ID] +
                                                       (ca.CalculatedRepeat > 0
                                                                  ? (int)ingred.Required *
                                                        (ca.CalculatedRepeat - ca.Casted)
                                                                  : 0)
                                                           : (ca.CalculatedRepeat > 0
                                                                  ? (int)ingred.Required *
                                                              (ca.CalculatedRepeat - ca.Casted)
                                                                  : 0);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Err(ex.ToString());
     }
 }
Beispiel #9
0
        public void GetMaterials(float id)
        {
            try
            {
                //connection.Open();
                using (SqlConnection connection = new SqlConnection(builder.ConnectionString))
                {
                    Products.Clear();
                    MaterialList.Clear();

                    connection.Open();
                    StringBuilder sb = new StringBuilder();

                    //sb.Append("SELECT * FROM JoelProducts");
                    sb.Append("SELECT * FROM Sheet1$ WHERE GRP_ID = " + id.ToString() + ";");
                    String sql = sb.ToString();

                    Console.WriteLine(sb.ToString());

                    using (SqlCommand command = new SqlCommand(sql, connection))
                    {
                        using (SqlDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                Material material = new Material
                                {
                                    Name = reader.GetString(0),
                                    //Material_Cost = (float)reader.GetDouble(1),
                                    Material_Cost = reader.IsDBNull(1) ? 0 : (float)reader.GetDouble(1),
                                    //Setup_Hr = (float)reader.GetDouble(2),
                                    //Setup_Cost = (UInt32)reader.GetDouble(3),
                                    //Operation_Hr = (float)reader.GetDouble(4),
                                    //Operation_Cost = (UInt32)reader.GetDouble(5),
                                    //Markup = (float)reader.GetDouble(6),
                                    Setup_Hr       = reader.IsDBNull(2) ? 0 : (float)reader.GetDouble(2),
                                    Setup_Cost     = reader.IsDBNull(3) ? 0 : (UInt32)reader.GetDouble(3),
                                    Operation_Hr   = reader.IsDBNull(4) ? 0 : (float)reader.GetDouble(4),
                                    Operation_Cost = reader.IsDBNull(5) ? 0 : (UInt32)reader.GetDouble(5),
                                    Markup         = reader.IsDBNull(6) ? 0 : (float)reader.GetDouble(6),
                                    Qty            = reader.IsDBNull(9) ? 0 : (UInt32)reader.GetDouble(9),
                                    Id             = (float)reader.GetInt32(7),
                                    Grp_Id         = reader.IsDBNull(8) ? 0 : (float)reader.GetInt32(8)
                                };

                                material.SetSubTotal();
                                material.SetPricePerPiece();

                                Products.Add(material);
                                MaterialList.Add(material);
                                Console.WriteLine("hey");
                            }
                            Console.WriteLine("heywala");
                        }
                    }
                }
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message + ex.Source);
            }
        }
Beispiel #10
0
    public void setup(MasterDataParamChara _chara, MasterDataParamCharaEvol _evolve = null, Texture2D _charaTexture = null, bool nameView = true)
    {
        charaMaster     = _chara;
        evolMaster      = _evolve;
        charaTexture    = _charaTexture;
        limitOverMaster = MasterFinder <MasterDataLimitOver> .Instance.Find((int)charaMaster.limit_over_type);

        IsViewNamePanel     = nameView;
        IsViewMaterialPanel = false;
        IsViewFloatWindow   = false;
        if (evolMaster != null)
        {
            IsViewMaterialPanel = true;

            MaterialValue = "";
            MaterialList.Clear();
            MaterialLabelX = -190;
            if (evolMaster.unit_id_parts1 != 0)
            {
                addMaterial(evolMaster.unit_id_parts1);
                MaterialLabelX += 64;
            }
            if (evolMaster.unit_id_parts2 != 0)
            {
                addMaterial(evolMaster.unit_id_parts2);
                MaterialLabelX += 64;
            }
            if (evolMaster.unit_id_parts3 != 0)
            {
                addMaterial(evolMaster.unit_id_parts3);
                MaterialLabelX += 64;
            }
            if (evolMaster.unit_id_parts4 != 0)
            {
                addMaterial(evolMaster.unit_id_parts4);
                MaterialLabelX += 64;
            }
        }

        charaOnce = new CharaOnce();
        charaOnce.CharaSetupFromID(
            charaMaster.fix_id,
            (int)charaMaster.level_max,
            (int)0,
            (int)limitOverMaster.limit_over_max,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0
            );

        Level          = string.Format(GameTextUtil.GetText("unit_status16"), charaOnce.m_CharaLevel, charaMaster.level_max);
        Hp             = charaOnce.m_CharaHP.ToString();
        HpPlus         = "";
        Atk            = charaOnce.m_CharaPow.ToString();
        AtkPlus        = "";
        Cost           = charaMaster.party_cost.ToString();
        LimitOver      = string.Format(GameTextUtil.GetText("unit_status16"), limitOverMaster.limit_over_max, limitOverMaster.limit_over_max);
        Charm          = charaOnce.m_CharaCharm.ToString("F1");
        ProfileMessage = charaMaster.detail.ReplaceSpaceTag(29).NoLineBreakTag();
    }
Beispiel #11
0
        public virtual void FromStream(Stream s, bool id)
        {
            Action <Action> action = delegate(Action a)
            {
                try
                {
                    a();
                }
                catch (Exception)
                {
                    LoadErrCount++;
                }
            };
            PmxHeader head = new PmxHeader();

            head.FromStreamEx(s);
            Header.FromHeader(head);
            head.ElementFormat.WithID = id;
            action(delegate
            {
                ModelInfo.FromStreamEx(s, head.ElementFormat);
            });
            int count = 0;

            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            VertexList.Clear();
            VertexList.Capacity = count;
            for (int k = 0; k < count; k++)
            {
                PmxVertex v = new PmxVertex();
                action(delegate
                {
                    v.FromStreamEx(s, head.ElementFormat);
                });
                VertexList.Add(v);
            }
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            FaceList.Clear();
            FaceList.Capacity = count;
            for (int l = 0; l < count; l++)
            {
                int ix = 0;
                action(delegate
                {
                    ix = PmxStreamHelper.ReadElement_Int32(s, head.ElementFormat.VertexSize, signed: false);
                });
                FaceList.Add(ix);
            }
            PmxTextureTable tx = new PmxTextureTable();

            action(delegate
            {
                tx.FromStreamEx(s, head.ElementFormat);
            });
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            MaterialList.Clear();
            MaterialList.Capacity = count;
            for (int m = 0; m < count; m++)
            {
                PmxMaterial j = new PmxMaterial();
                action(delegate
                {
                    j.FromStreamEx_TexTable(s, tx, head.ElementFormat);
                });
                MaterialList.Add(j);
            }
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            BoneList.Clear();
            BoneList.Capacity = count;
            for (int n = 0; n < count; n++)
            {
                PmxBone b = new PmxBone();
                action(delegate
                {
                    b.FromStreamEx(s, head.ElementFormat);
                });
                BoneList.Add(b);
            }
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            MorphList.Clear();
            MorphList.Capacity = count;
            for (int num = 0; num < count; num++)
            {
                PmxMorph morph = new PmxMorph();
                action(delegate
                {
                    morph.FromStreamEx(s, head.ElementFormat);
                });
                MorphList.Add(morph);
            }
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            NodeList.Clear();
            NodeList.Capacity = count;
            for (int num2 = 0; num2 < count; num2++)
            {
                PmxNode node = new PmxNode();
                action(delegate
                {
                    node.FromStreamEx(s, head.ElementFormat);
                });
                NodeList.Add(node);
                if (NodeList[num2].SystemNode)
                {
                    if (NodeList[num2].Name == "Root")
                    {
                        RootNode = NodeList[num2];
                    }
                    else if (NodeList[num2].Name == "表情")
                    {
                        ExpNode = NodeList[num2];
                    }
                }
            }
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            BodyList.Clear();
            BodyList.Capacity = count;
            for (int num3 = 0; num3 < count; num3++)
            {
                PmxBody b2 = new PmxBody();
                action(delegate
                {
                    b2.FromStreamEx(s, head.ElementFormat);
                });
                BodyList.Add(b2);
            }
            action(delegate
            {
                count = PmxStreamHelper.ReadElement_Int32(s);
            });
            JointList.Clear();
            JointList.Capacity = count;
            for (int num4 = 0; num4 < count; num4++)
            {
                PmxJoint i = new PmxJoint();
                action(delegate
                {
                    i.FromStreamEx(s, head.ElementFormat);
                });
                JointList.Add(i);
            }
            if (head.Ver >= 2.1f)
            {
                action(delegate
                {
                    count = PmxStreamHelper.ReadElement_Int32(s);
                });
                SoftBodyList.Clear();
                SoftBodyList.Capacity = count;
                for (int num5 = 0; num5 < count; num5++)
                {
                    PmxSoftBody b3 = new PmxSoftBody();
                    action(delegate
                    {
                        b3.FromStreamEx(s, head.ElementFormat);
                    });
                    SoftBodyList.Add(b3);
                }
            }
            if (id)
            {
                action(delegate
                {
                    FilePath = PmxStreamHelper.ReadString(s, head.ElementFormat);
                });
            }
            head.ElementFormat.WithID = false;
        }
Beispiel #12
0
    public void setup(uint unit_id, PacketStructUnit _mainUnit, PacketStructUnit _subUnit, Image Chara, Image Shadow)
    {
        lvMax       = false;
        charaMaster = MasterFinder <MasterDataParamChara> .Instance.Find((int)unit_id);

        m_UnitId   = unit_id;
        m_mainUnit = _mainUnit;
        m_subUnit  = _subUnit;
        CharaOnce charaOnce = setParam();

        if (_mainUnit == null)
        {
            IsExpActive      = false;
            linkButtonEnable = false;
            LinkButtonColor  = Color.gray;
        }
        else
        {
            //-----------------------
            // 次のレベルまでの経験値を算出
            //-----------------------
            int   nNowLevelExp  = CharaUtil.GetStatusValue(charaMaster, (int)_mainUnit.level, CharaUtil.VALUE.EXP);
            int   nNextLevelExp = CharaUtil.GetStatusValue(charaMaster, (int)_mainUnit.level + 1, CharaUtil.VALUE.EXP);
            int   nLevelupExp   = nNextLevelExp - nNowLevelExp;
            int   nNextEXP      = 0;
            float expRatio      = 0.0f;
            if (nLevelupExp > 0)
            {
                nNextEXP = nNextLevelExp - (int)_mainUnit.exp;
                expRatio = (float)(nLevelupExp - nNextEXP) / nLevelupExp;
            }
            NextExp     = nNextEXP;
            ExpRate     = expRatio;
            IsExpActive = true;
        }

        CharaSprite       = Chara.sprite;
        CharaMaterial     = Chara.material;
        ShadowSprite      = Shadow.sprite;
        ShadowMaterial    = Shadow.material;
        CharaSpriteWidth  = CharaSprite.texture.GetUnitTextureWidth();
        CharaSpriteHeight = CharaSprite.texture.GetUnitTextureHeight();

        ProfileMessage = charaMaster.detail.ReplaceSpaceTag(29).NoLineBreakTag();

        IsViewMaterialPanel = false;
        IsViewFloatWindow   = false;
        MasterDataParamCharaEvol _evolAfter = MasterDataUtil.GetCharaEvolParamFromCharaID(unit_id);

        if (_evolAfter != null)
        {
            IsViewMaterialPanel = true;

            MaterialValue = "";
            MaterialList.Clear();
            MaterialLabelX = 108;
            if (_evolAfter.unit_id_parts1 != 0)
            {
                addMaterial(_evolAfter.unit_id_parts1);
                MaterialLabelX += 64;
            }
            if (_evolAfter.unit_id_parts2 != 0)
            {
                addMaterial(_evolAfter.unit_id_parts2);
                MaterialLabelX += 64;
            }
            if (_evolAfter.unit_id_parts3 != 0)
            {
                addMaterial(_evolAfter.unit_id_parts3);
                MaterialLabelX += 64;
            }
            if (_evolAfter.unit_id_parts4 != 0)
            {
                addMaterial(_evolAfter.unit_id_parts4);
                MaterialLabelX += 64;
            }
        }
        ScrollRect srect = GetComponentInChildren <ScrollRect>();

        if (srect != null)
        {
            srect.verticalNormalizedPosition = 1;
        }
    }