예제 #1
0
            public bool needDelete = false; // 是否需要删除

            public int CompareTo(object obj)
            {
                MatInfo b = obj as MatInfo;

                if (b.priority < priority)// 先比较优先级,priority值越小则优先级越高
                {
                    return(1);
                }
                if (b.priority > priority)
                {
                    return(-1);
                }
                else
                {
                    if (b.startTime > startTime)// 比较开始时间,开始时间越晚则优先级越高
                    {
                        return(1);
                    }
                    else if (b.startTime < startTime)
                    {
                        return(-1);
                    }
                    else
                    {
                        return(0);
                    }
                }
            }
예제 #2
0
    public WeapArmorBaseInfo(string namey, int BaseDam, int BaseDur, int BaseRan, int BaseDef, int BaseWe, bool One, List <Partinfo> Party, int CraftPerSlot, int TimetoC, int baseprice, int basebeaut)
    {
        BaseBeauty    = basebeaut;
        BaseDefense   = BaseDef;
        name          = namey;
        BaseWeight    = BaseWe;
        Onehand       = One;
        BaseDamage    = BaseDam;
        BaseDurablity = BaseDur;
        BaseRange     = BaseRan;

        Parts = new List <Partinfo>();
        foreach (Partinfo temper in Party)
        {
            Partinfo temp = new Partinfo();
            temp.Mat           = MatInfo.copyMe(temper.Mat);
            temp.Name          = temper.Name;
            temp.DamagePercent = temper.DamagePercent;
            temp.DefPercent    = temper.DefPercent;
            temp.DurPercent    = temper.DurPercent;
            temp.WeightPercent = temper.WeightPercent;
            temp.PricePercent  = temper.PricePercent;

            Parts.Add(temp);
        }
        CostToCraftPerSlot = CraftPerSlot;
        TimeToCraft        = TimetoC;
        Price = baseprice;
    }
예제 #3
0
    public static WeapArmorBaseInfo Copyme(WeapArmorBaseInfo copy)
    {
        WeapArmorBaseInfo temp = new WeapArmorBaseInfo();

        temp.BaseBeauty    = copy.BaseBeauty;
        temp.name          = copy.name;
        temp.BaseDamage    = copy.BaseDamage;
        temp.BaseDurablity = copy.BaseDurablity;
        temp.BaseRange     = copy.BaseRange;
        temp.BaseDefense   = copy.BaseDefense;
        foreach (Partinfo temper in copy.Parts)
        {
            Partinfo tempy = new Partinfo();
            tempy.Mat           = MatInfo.copyMe(temper.Mat);
            tempy.Name          = temper.Name;
            tempy.DamagePercent = temper.DamagePercent;
            tempy.DefPercent    = temper.DefPercent;
            tempy.DurPercent    = temper.DurPercent;
            tempy.WeightPercent = temper.WeightPercent;
            tempy.PricePercent  = temper.PricePercent;

            temp.Parts.Add(tempy);
        }
        temp.BaseWeight         = copy.BaseWeight;
        temp.Onehand            = copy.Onehand;
        temp.CostToCraftPerSlot = copy.CostToCraftPerSlot;
        temp.TimeToCraft        = copy.TimeToCraft;
        temp.Price = copy.Price;
        return(temp);
    }
예제 #4
0
    public static MatInfo copyMe(MatInfo copy)
    {
        MatInfo temp = new MatInfo();

        temp.BaseDurablity      = copy.BaseDurablity;
        temp.Blacksmithlevelreq = copy.Blacksmithlevelreq;
        temp.CanSpawnIn         = copy.CanSpawnIn;
        temp.Density            = copy.Density;
        temp.DensityName        = copy.DensityName;
        temp.HeroLevelreq       = copy.HeroLevelreq;
        temp.Name          = copy.Name;
        temp.NodeMaxAmount = copy.NodeMaxAmount;
        temp.NodeMinAmount = copy.NodeMinAmount;
        temp.Quality       = copy.Quality;
        temp.QualityName   = copy.QualityName;
        temp.TimeToMineOne = copy.TimeToMineOne;
        temp.isMineral     = copy.isMineral;
        temp.PriceMod      = copy.PriceMod;

        temp.BaseDefense     = copy.BaseDefense;
        temp.BaseBeauty      = copy.BaseBeauty;
        temp.BaseMeleeDamage = copy.BaseMeleeDamage;
        temp.BaseRangeDamage = copy.BaseRangeDamage;
        temp.TimeToRefine    = copy.TimeToRefine;
        temp.TimetoSmith     = copy.TimetoSmith;
        temp.BaseWeight      = copy.BaseWeight;
        temp.isRefine        = copy.isRefine;
        return(temp);
    }
 public ResNodeinfo()
 {
     AmountLeft  = 0;
     ResType     = new MatInfo();
     IsMinebuilt = false;
     MineLevel   = 0;
 }
예제 #6
0
    // Use this for initialization
    void Start()
    {
        Transform[] trans = transform.GetComponentsInChildren <Transform>();
        Cam       = Camera.main.transform.gameObject;
        ListGobjs = new List <MatInfo>();
        foreach (Transform tran in trans)
        {
            meshrender = tran.gameObject.GetComponent <MeshRenderer>();
            if (meshrender != null)
            {
                MatInfo Mat = new MatInfo();
                //////////
                //Material mat = meshrender.sharedMaterial;
                //Material instMaterial = Instantiate(mat) as Material;
                //meshrender.sharedMaterial = instMaterial;
                //////////////////////
                Mat.nQNum = meshrender.sharedMaterial.renderQueue - 3000;
                meshrender.sharedMaterial = Instantiate(meshrender.sharedMaterial) as Material;
                Mat.mat = meshrender.sharedMaterial;

                Mat.tran = transform;

                ListGobjs.Add(Mat);
            }
        }
    }
예제 #7
0
        /// <summary>
        /// 核销入库
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnVerificateIn_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();

            try
            {
                this.dataGridview.EndEdit();
                List <MatInfo> matInfos      = new List <MatInfo>();
                ListModalForm  listModalForm = new ListModalForm("01", "add", this.receiptId, "add_03_01");
                foreach (DataGridViewRow dgvr in dataGridview.Rows)
                {
                    if (dgvr.Cells["单据号"].Value == null || dgvr.Cells["物料编码"].Value == null)
                    {
                        continue;
                    }
                    string  SStoreHId = (new DBUtil()).Get_Single_val("T_Receipt_Main", "SourceStoreH", "ReceiptId", dgvr.Cells["单据号"].Value.ToString().Trim());
                    MatInfo matInfo   = new MatInfo();
                    if (dgvr.Cells["物料编码"].Value != null)
                    {
                        matInfo.matId = dgvr.Cells["物料编码"].Value.ToString().Trim();
                    }
                    if (dgvr.Cells["数量"].Value != null && dgvr.Cells["数量"].Value.ToString().Trim() != "")
                    {
                        matInfo.num = Convert.ToDouble(dgvr.Cells["数量"].Value.ToString().Trim());
                    }
                    if (dgvr.Cells["单价"].Value != null && dgvr.Cells["单价"].Value.ToString().Trim() != "")
                    {
                        matInfo.price = Convert.ToDouble(dgvr.Cells["单价"].Value.ToString().Trim());
                    }
                    if (dgvr.Cells["单据号"].Value != null && dgvr.Cells["单据号"].Value.ToString().Trim() != "")
                    {
                        matInfo.receiptId = dgvr.Cells["单据号"].Value.ToString().Trim();
                    }
                    if (dgvr.Cells["顺序号"].Value != null && dgvr.Cells["顺序号"].Value.ToString().Trim() != "")
                    {
                        matInfo.orderNo = Convert.ToInt32(dgvr.Cells["顺序号"].Value.ToString().Trim());
                    }
                    if (dgvr.Cells["类型"].Value != null && dgvr.Cells["类型"].Value.ToString().Trim() != "")
                    {
                        matInfo.matType = Convert.ToInt32(dgvr.Cells["类型"].Value.ToString().Trim());
                    }
                    matInfo.notVerNum = notVerNums[dgvr.Index];//未核销数量(修改前)
                    matInfo.SStoreHId = SStoreHId;

                    matInfos.Add(matInfo);
                }

                listModalForm.MdiParent   = mainForm;
                listModalForm.matInfos_03 = matInfos;//
                listModalForm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
예제 #8
0
        /// <summary>
        /// 开启材质特效
        /// </summary>
        /// <param name="m"></param>
        private void BeginMat(MatInfo m)
        {
            foreach (KeyValuePair <Renderer, Material> kvp in m_InitMat)
            {
                if (kvp.Key == null)
                {
                    continue;
                }

                var mat_info = m_InitMatExtra[kvp.Key];

                Material new_mat = null;
                switch (m.type)
                {
                case MAT_TYPE.HURT_HIGHLIGHT:
                    mat_info.Instance            = true;
                    kvp.Key.material             = MAT_HURT_HIGHLIGHT;    // 将原始材质修改为HURT_HIGHLIGHT的材质
                    kvp.Key.material.mainTexture = kvp.Value.mainTexture; // texture赋值

                    break;

                case MAT_TYPE.DEAD_DISSOLVE:
                    mat_info.Instance   = true;
                    kvp.Key.material    = MAT_DEAD_DISSOLVE;     // 将原始材质修改为HURT_HIGHLIGHT的材质
                    new_mat             = kvp.Key.material;
                    new_mat.mainTexture = kvp.Value.mainTexture; // texture赋值
                    if (new_mat.HasProperty("_Normal") && kvp.Value.HasProperty("_Normal"))
                    {
                        new_mat.SetTexture("_Normal", kvp.Value.GetTexture("_Normal"));    // normalmap texture
                    }
                    m_Dissolve_Time  = 0;
                    m_DissolveActive = true;
                    break;

                case MAT_TYPE.DEAD_TOMBSTONE:
                    mat_info.Instance   = true;
                    kvp.Key.material    = MAT_TOMB_STONE;        // 将原始材质修改为STONE的材质
                    new_mat             = kvp.Key.material;
                    new_mat.mainTexture = kvp.Value.mainTexture; // texture赋值
                    if (new_mat.HasProperty("_Normal") && kvp.Value.HasProperty("_Normal"))
                    {
                        new_mat.SetTexture("_Normal", kvp.Value.GetTexture("_Normal"));    // normalmap texture
                    }
                    m_StoneTime   = 0;
                    m_StoneActive = true;
                    break;

                case MAT_TYPE.OUTLING:
                    mat_info.Instance = true;
                    kvp.Key.material  = MAT_OUTLING;   // 将原始材质修改为Outing的材质
                    break;

                default:
                    break;
                }
            }
        }
예제 #9
0
 public Partinfo(string na, MatInfo ma, float damange, float weight, float dur, float def, float price)
 {
     Name          = na;
     Mat           = MatInfo.copyMe(ma);
     DamagePercent = damange;
     WeightPercent = weight;
     DurPercent    = dur;
     DefPercent    = def;
     PricePercent  = price;
 }
예제 #10
0
        /// <summary>
        /// 添加材质特效
        /// </summary>
        /// <param name="time"></param>
        /// <param name="type"></param>
        /// <param name="pri"></param>
        /// <returns></returns>
        public MatInfo AddEffectMat(float time, MAT_TYPE type, Priority pri)
        {
            MatInfo m = new MatInfo();

            m.startTime = Time.time;
            m.endTime   = m.startTime + time;
            m.type      = type;
            m.priority  = (int)pri;

            m_MatList.Add(m);
            OnMatListChange();
            return(m);
        }
    public static ResNodeinfo Copyme(ResNodeinfo copy)
    {
        ResNodeinfo temp = new ResNodeinfo();

        temp.AmountLeft  = copy.AmountLeft;
        temp.IsMinebuilt = copy.IsMinebuilt;
        temp.MineLevel   = copy.MineLevel;
        temp.ResType     = MatInfo.copyMe(copy.ResType);



        return(temp);
    }
예제 #12
0
 public IntrinsicInfo(Mat cameraMatrix, Mat distCoeffs, List <Mat> rvecs, List <Mat> tvecs)
 {
     this.rvecs        = new List <MatInfo>();
     this.tvecs        = new List <MatInfo>();
     this.cameraMatrix = new MatInfo(cameraMatrix);
     this.distCoeffs   = new MatInfo(distCoeffs);
     foreach (var rvec in rvecs)
     {
         this.rvecs.Add(new MatInfo(rvec));
     }
     foreach (var tvec in tvecs)
     {
         this.tvecs.Add(new MatInfo(tvec));
     }
 }
예제 #13
0
 public void AddResource(MatInfo res, int amount, bool Refined)
 {
     if (Refined == false)
     {
         if (res.QualityName == "Poor")
         {
             RawResource [RawResource.FindIndex(x => x.Name == res.Name)].UPoor += amount;
         }
         else if (res.QualityName == "Common")
         {
             RawResource [RawResource.FindIndex(x => x.Name == res.Name)].UCommon += amount;
         }
         else if (res.QualityName == "Good")
         {
             RawResource [RawResource.FindIndex(x => x.Name == res.Name)].UGood += amount;
         }
         else
         {
             RawResource [RawResource.FindIndex(x => x.Name == res.Name)].USuperior += amount;
         }
     }
     else
     {
         if (res.QualityName == "Poor")
         {
             RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RPoor += amount;
         }
         else if (res.QualityName == "Common")
         {
             RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RCommon += amount;
         }
         else if (res.QualityName == "Good")
         {
             RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RGood += amount;
         }
         else
         {
             RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RSuperior += amount;
         }
     }
 }
예제 #14
0
        /// <summary>
        /// 材质列表发生变化时调用
        /// </summary>
        private void OnMatListChange()
        {
            if (m_InitMat.Count == 0)
            {
                InitMat();
            }

            // 如果材质列表为空,则恢复原始的材质
            if (m_MatList.Count < 1)
            {
                Recover();
                return;
            }

            // 先恢复原始材质
            Recover();

            // 开启新材质效果
            m_MatList.Sort();
            MatInfo m = m_MatList[0];

            BeginMat(m);
            m_RecoverState = false;
        }
예제 #15
0
    public bool CanIHaveResource(MatInfo res, bool isRefined, float amount)
    {
        if (isRefined == false)
        {
            if (res.QualityName == "Poor")
            {
                if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].UPoor - amount >= 0.0f)
                {
                    RawResource [RawResource.FindIndex(x => x.Name == res.Name)].UPoor -= amount;
                    return(true);
                }
            }
            else if (res.QualityName == "Common")
            {
                if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].UCommon - amount >= 0.0f)
                {
                    RawResource [RawResource.FindIndex(x => x.Name == res.Name)].UCommon -= amount;
                    return(true);
                }
            }
            else if (res.QualityName == "Good")
            {
                if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].UGood - amount >= 0.0f)
                {
                    RawResource [RawResource.FindIndex(x => x.Name == res.Name)].UGood -= amount;
                    return(true);
                }
            }
            else
            {
                if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].USuperior - amount >= 0.0f)
                {
                    RawResource [RawResource.FindIndex(x => x.Name == res.Name)].USuperior -= amount;
                    return(true);
                }
            }
        }
        else
        {
            if (res.QualityName == "Poor")
            {
                if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RPoor - amount >= 0.0f)
                {
                    RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RPoor -= amount;
                    return(true);
                }
            }
            else if (res.QualityName == "Common")
            {
                if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RCommon - amount >= 0.0f)
                {
                    RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RCommon -= amount;
                    return(true);
                }
            }
            else if (res.QualityName == "Good")
            {
                if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RGood - amount >= 0.0f)
                {
                    RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RGood -= amount;
                    return(true);
                }
            }
            else
            {
                if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RSuperior - amount >= 0.0f)
                {
                    RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RSuperior -= amount;
                    return(true);
                }
            }
        }

        return(false);
    }
예제 #16
0
 public bool IsResourceMax(MatInfo res, int amount, bool Refined)
 {
     if (Refined == false)
     {
         if (res.QualityName == "Poor")
         {
             if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].UPoor + amount > ResourceMax)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else if (res.QualityName == "Common")
         {
             if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].UCommon + amount > ResourceMax)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else if (res.QualityName == "Good")
         {
             if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].UGood + amount > ResourceMax)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].USuperior + amount > ResourceMax)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     else
     {
         if (res.QualityName == "Poor")
         {
             if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RPoor + amount > ResourceMax)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else if (res.QualityName == "Common")
         {
             if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RCommon + amount > ResourceMax)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else if (res.QualityName == "Good")
         {
             if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RGood + amount > ResourceMax)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             if (RawResource [RawResource.FindIndex(x => x.Name == res.Name)].RSuperior + amount > ResourceMax)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         Debug.LogError("Resmax is wrong");
         return(true);
     }
 }
예제 #17
0
    //public MatInfo(int Basedur,string Myname, int herolevel,int blacklevl,int CanSpawnlevel, int NodeMin, int NodeMax,int TimeMine,bool Minorwud,int BaseDef,int BaseBea,int BaseMelDam,int BaseRangDam,int TimeRef,int TimeSmit)

    public MatInfo GetMatInfo(string finder)
    {
        return(MatInfo.copyMe(MatType.Find(x => x.Name == finder)));
    }
예제 #18
0
        public override void Update()
        {
            base.Update();

            UpdateDissolve();
            UpdateStone();

            if (m_StoneActive || m_DissolveActive)
            {
                foreach (KeyValuePair <Renderer, Material> kvp in m_InitMat)
                {
                    if (kvp.Key == null || kvp.Value == null)
                    {
                        continue;
                    }

                    var mat_info = m_InitMatExtra[kvp.Key];
                    if (mat_info.Instance == false)
                    {
                        continue;
                    }

                    Material mat = kvp.Key.sharedMaterial; // 在m_InitMat列表中的Material已经在初始化的时候进行了Instance
                    if (mat.HasProperty("_Progress"))
                    {
                        mat.SetFloat("_Progress", 1 - m_DissolveProgress);
                    }
                    else if (mat.HasProperty("_StoneProgress"))
                    {
                        mat.SetFloat("_StoneProgress", 1 - m_StoneProgress);
                    }
                }
            }

            if (m_MatList.Count < 1)
            {
                return;
            }

            float t = Time.time;

            bool    currentChanged = false;
            MatInfo current        = m_MatList[0];

            foreach (MatInfo m in m_MatList)
            {
                // 如果材质效果的时间周期已到,则将其从列表中移除
                if (m.endTime != m.startTime && t > m.endTime)
                {
                    m.needDelete = true;
                    if (m == current)
                    {
                        currentChanged = true;
                    }
                }
            }

            // 从列表中移除
            m_MatList.RemoveAll(item => item.needDelete == true);

            // 如果移除的是当前正在使用的特效,则要进行其他更新操作
            if (currentChanged)
            {
                OnMatListChange();
            }
        }
예제 #19
0
 public Partinfo()
 {
     Name = "";
     Mat  = new MatInfo();
 }
    public ResNodeinfo(int left, MatInfo res, bool mine, int minelvl)
    {
        if (left != 0)
        {
            AmountLeft = left;
        }
        else
        {
            AmountLeft = Random.Range(res.NodeMinAmount, res.NodeMaxAmount + 1);
        }
        ResType     = MatInfo.copyMe(res);
        IsMinebuilt = mine;
        MineLevel   = minelvl;

        ResType.Quality = (Random.Range(0, 130));

        if (ResType.Quality <= 25)
        {
            ResType.QualityName = "Poor";
            ResType.Quality     = 15;
        }
        else if (ResType.Quality <= 50)
        {
            ResType.QualityName = "Common";
            ResType.Quality     = 45;
        }
        else if (ResType.Quality <= 75)
        {
            ResType.QualityName = "Good";
            ResType.Quality     = 70;
        }
        else
        {
            ResType.QualityName = "Superiour";
            ResType.Quality     = 85;
        }


        ResType.Density = (float)System.Math.Round((double)(Random.Range(0.0f, 1.10f)), 2);

        if (ResType.Density <= .25)
        {
            ResType.DensityName = "Sparse";
            ResType.Density     = .25f;
        }
        else if (ResType.Density <= .50)
        {
            ResType.DensityName = "Average";
            ResType.Density     = .50f;
        }
        else if (ResType.Density <= .75)
        {
            ResType.DensityName = "Abundant";
            ResType.Density     = .75f;
        }
        else
        {
            ResType.DensityName = "Rich";
            ResType.Density     = 1.0f;
        }
    }