Exemple #1
0
    private static ItemProto GenItemData(VCIsoHeadData headData, int objId)
    {
        CreationAttr attribute = GetCreationAttr(headData.Remarks);

        // 0.9 id修改 转换检测
        attribute.CheckCostId();
        ItemProto item = CreationData.StaticGenItemData(objId, headData, attribute);

        return(item);
    }
    public void OnCreationInfoRefresh()
    {
        CreationAttr attr = null;

        if (m_IsEditor)
        {
            CreationData.CalcCreationAttr(VCEditor.s_Scene.m_IsoData, 0, ref VCEditor.s_Scene.m_CreationAttr);
            attr = VCEditor.s_Scene.m_CreationAttr;
        }
        else
        {
            VCIsoRemark remark = new VCIsoRemark();
            remark.xml = m_NonEditorRemark;
            attr       = remark.m_Attribute;

            // 0.9 ID改变处理
            if (attr != null)
            {
                attr.CheckCostId();
            }
            m_CostList.m_NonEditorAttr = attr;
            if (remark.m_Error != null && remark.m_Error.Length > 1)
            {
                m_NonEditorError = "ISO version is obsolete".ToLocalizationString();
            }
            else
            {
                m_NonEditorError = "";
            }
        }

        UpdateItemsTrackState(attr);

        if (attr != null)
        {
            // 上面是否调用了 CalcCreationAttr ? 为什么属性会不同???

            // [VCCase] - Creation attribute info. UI
            if (attr.m_Type == ECreation.Sword || attr.m_Type == ECreation.SwordLarge || attr.m_Type == ECreation.SwordDouble || attr.m_Type == ECreation.Axe)
            {
                m_AttrNames.text = "Creation".ToLocalizationString() + ":\r\n" +
                                   "Weight".ToLocalizationString() + ":\r\n" +
                                   //"Volume".ToLocalizationString() + ":\r\n" +
                                   "Sell Price".ToLocalizationString() + ":\r\n\r\n" +
                                   "Attack".ToLocalizationString() + ":\r\n" +
                                   "Durability".ToLocalizationString() + ":\r\n\r\n";

                m_AttrValues.text = (attr.m_Type == ECreation.Sword || attr.m_Type == ECreation.SwordLarge || attr.m_Type == ECreation.SwordDouble? "Sword".ToLocalizationString() + "\r\n" : "Axe".ToLocalizationString() + "\r\n") +
                                    VCUtils.WeightToString(attr.m_Weight) + "\r\n" +
                                    //VCUtils.VolumeToString(attr.m_Volume) + "\r\n" +
                                    (attr.m_SellPrice).ToString("#,##0") + " " + "Meat".ToLocalizationString() +
                                    "\r\n\r\n" + (attr.m_Attack).ToString("0.0") + "\r\n" +
                                    (Mathf.CeilToInt(attr.m_Durability * WhiteCat.PEVCConfig.equipDurabilityShowScale)).ToString("0.0") + "\r\n";
            }

            else if (attr.m_Type == ECreation.Bow)
            {
                m_AttrNames.text = "Creation".ToLocalizationString() + ":\r\n" +
                                   "Weight".ToLocalizationString() + ":\r\n" +
                                   "Volume".ToLocalizationString() + ":\r\n" +
                                   "Sell Price".ToLocalizationString() + ":\r\n\r\n" +
                                   "Attack".ToLocalizationString() + ":\r\n" +
                                   "Durability".ToLocalizationString() + ":\r\n\r\n";

                m_AttrValues.text = "Bow".ToLocalizationString() + "\r\n" +
                                    VCUtils.WeightToString(attr.m_Weight) + "\r\n" +
                                    VCUtils.VolumeToString(attr.m_Volume) + "\r\n" +
                                    (attr.m_SellPrice).ToString("#,##0") +
#if PLANET_EXPLORERS
                                    " " + "Meat".ToLocalizationString() +
#endif
                                    "\r\n\r\n" + (attr.m_Attack).ToString("0.0") + "\r\n" +
                                    (Mathf.CeilToInt(attr.m_Durability * WhiteCat.PEVCConfig.equipDurabilityShowScale)).ToString("0.0") + "\r\n";
            }

            else if (attr.m_Type == ECreation.Shield)
            {
                m_AttrNames.text = "Creation".ToLocalizationString() + ":\r\n" +
                                   "Weight".ToLocalizationString() + ":\r\n" +
                                   "Volume".ToLocalizationString() + ":\r\n" +
                                   "Sell Price".ToLocalizationString() + ":\r\n\r\n" +
                                   "Defense".ToLocalizationString() + ":\r\n" +
                                   "Durability".ToLocalizationString() + ":\r\n\r\n";

                m_AttrValues.text = "Shield".ToLocalizationString() + "\r\n" +
                                    VCUtils.WeightToString(attr.m_Weight) + "\r\n" +
                                    VCUtils.VolumeToString(attr.m_Volume) + "\r\n" +
                                    (attr.m_SellPrice).ToString("#,##0") +
        #if PLANET_EXPLORERS
                                    " " + "Meat".ToLocalizationString() +
        #endif
                                    "\r\n\r\n" + (attr.m_Defense).ToString("0.0") + "\r\n" +
                                    (Mathf.CeilToInt(attr.m_Durability * WhiteCat.PEVCConfig.equipDurabilityShowScale)).ToString("0.0") + "\r\n";
            }
            else if (attr.m_Type == ECreation.HandGun || attr.m_Type == ECreation.Rifle)
            {
                m_AttrNames.text = "Creation".ToLocalizationString() + ":\r\n" +
                                   "Weight".ToLocalizationString() + ":\r\n" +
                                   "Volume".ToLocalizationString() + ":\r\n" +
                                   "Sell Price".ToLocalizationString() + ":\r\n\r\n" +
                                   "Increase".ToLocalizationString() + ":\r\n" +
                                   "Final Attack".ToLocalizationString() + ":\r\n" +
                                   "Firing Rate".ToLocalizationString() + ":\r\n" +
                                   "Accuracy".ToLocalizationString() + ":\r\n" +
                                   "Durability".ToLocalizationString() + ":\r\n\r\n";

                m_AttrValues.text = ((attr.m_Type == ECreation.HandGun) ? ("Hand Gun".ToLocalizationString() + "\r\n") : ("Rifle".ToLocalizationString() + "\r\n")) +
                                    VCUtils.WeightToString(attr.m_Weight) + "\r\n" +
                                    VCUtils.VolumeToString(attr.m_Volume) + "\r\n" +
                                    (attr.m_SellPrice).ToString("#,##0") +
        #if PLANET_EXPLORERS
                                    " " + "Meat".ToLocalizationString() +
        #endif
                                    "\r\n\r\n" + ((attr.m_MuzzleAtkInc == 0) ? ("-") : (attr.m_MuzzleAtkInc * 100.0f - 100.0f).ToString("0.0")) + " %\r\n" +
                                    (attr.m_Attack).ToString("0.0") + "\r\n" +
                                    (attr.m_FireSpeed).ToString("0.0") + "\r\n" +
                                    (1.0f / attr.m_Accuracy * 100).ToString("0.0") + " %\r\n" +
                                    (Mathf.CeilToInt(attr.m_Durability * WhiteCat.PEVCConfig.equipDurabilityShowScale)).ToString("0.0") + "\r\n";
            }
            else if (attr.m_Type == ECreation.Vehicle)
            {
                m_AttrNames.text = "Creation".ToLocalizationString() + ":\r\n" +
                                   "Weight".ToLocalizationString() + ":\r\n" +
                                   "Volume".ToLocalizationString() + ":\r\n" +
                                   "Sell Price".ToLocalizationString() + ":\r\n\r\n" +
                                   "Attack".ToLocalizationString() + ":\r\n" +
                                   "Durability".ToLocalizationString() + ":\r\n" +
                                   "Fuel".ToLocalizationString() + ":\r\n\r\n";

                m_AttrValues.text = "Vehicle".ToLocalizationString() + "\r\n" +
                                    VCUtils.WeightToString(attr.m_Weight) + "\r\n" +
                                    VCUtils.VolumeToString(attr.m_Volume) + "\r\n" +
                                    (attr.m_SellPrice).ToString("#,##0") +
        #if PLANET_EXPLORERS
                                    " " + "Meat".ToLocalizationString() +
        #endif
                                    "\r\n\r\n" +
                                    (attr.m_Attack).ToString("#,##0") + " /s\r\n" +
                                    (attr.m_Durability).ToString("#,##0") + "\r\n" +
                                    (attr.m_MaxFuel).ToString("#,##0") + "\r\n";
            }
            else if (attr.m_Type == ECreation.Aircraft)
            {
                m_AttrNames.text = "Creation".ToLocalizationString() + ":\r\n" +
                                   "Weight".ToLocalizationString() + ":\r\n" +
                                   "Volume".ToLocalizationString() + ":\r\n" +
                                   "Sell Price".ToLocalizationString() + ":\r\n\r\n" +
                                   "Attack".ToLocalizationString() + ":\r\n" +
                                   "Durability".ToLocalizationString() + ":\r\n" +
                                   "Fuel".ToLocalizationString() + ":\r\n\r\n";

                m_AttrValues.text = "Aircraft".ToLocalizationString() + "\r\n" +
                                    VCUtils.WeightToString(attr.m_Weight) + "\r\n" +
                                    VCUtils.VolumeToString(attr.m_Volume) + "\r\n" +
                                    (attr.m_SellPrice).ToString("#,##0") +
                                                #if PLANET_EXPLORERS
                                    " " + "Meat".ToLocalizationString() +
                                                #endif
                                    "\r\n\r\n" +
                                    (attr.m_Attack).ToString("#,##0") + " /s\r\n" +
                                    (attr.m_Durability).ToString("#,##0") + "\r\n" +
                                    (attr.m_MaxFuel).ToString("#,##0") + "\r\n";
            }
            else if (attr.m_Type == ECreation.Boat)
            {
                m_AttrNames.text = "Creation".ToLocalizationString() + ":\r\n" +
                                   "Weight".ToLocalizationString() + ":\r\n" +
                                   "Volume".ToLocalizationString() + ":\r\n" +
                                   "Sell Price".ToLocalizationString() + ":\r\n\r\n" +
                                   "Attack".ToLocalizationString() + ":\r\n" +
                                   "Durability".ToLocalizationString() + ":\r\n" +
                                   "Fuel".ToLocalizationString() + ":\r\n\r\n";

                m_AttrValues.text = "Boat".ToLocalizationString() + "\r\n" +
                                    VCUtils.WeightToString(attr.m_Weight) + "\r\n" +
                                    VCUtils.VolumeToString(attr.m_Volume) + "\r\n" +
                                    (attr.m_SellPrice).ToString("#,##0") +
                                                #if PLANET_EXPLORERS
                                    " " + "Meat".ToLocalizationString() +
                                                #endif
                                    "\r\n\r\n" +
                                    (attr.m_Attack).ToString("#,##0") + " /s\r\n" +
                                    (attr.m_Durability).ToString("#,##0") + "\r\n" +
                                    (attr.m_MaxFuel).ToString("#,##0") + "\r\n";
            }
            else if (attr.m_Type == ECreation.SimpleObject)
            {
                m_AttrNames.text = "Creation".ToLocalizationString() + ":\r\n" +
                                   "Weight".ToLocalizationString() + ":\r\n" +
                                   "Volume".ToLocalizationString() + ":\r\n" +
                                   "Sell Price".ToLocalizationString() + ":\r\n\r\n" +
                                   "Durability".ToLocalizationString() + ":\r\n\r\n";

                m_AttrValues.text = "Object".ToLocalizationString() + "\r\n" +
                                    VCUtils.WeightToString(attr.m_Weight) + "\r\n" +
                                    VCUtils.VolumeToString(attr.m_Volume) + "\r\n" +
                                    (attr.m_SellPrice).ToString("#,##0") +
                                                #if PLANET_EXPLORERS
                                    " " + "Meat".ToLocalizationString() +
                                                #endif
                                    "\r\n\r\n" + (attr.m_Durability).ToString("#,##0") + "\r\n";
            }
            else if (attr.m_Type == ECreation.Robot)
            {
                m_AttrNames.text = "Creation".ToLocalizationString() + ":\r\n" +
                                   "Weight".ToLocalizationString() + ":\r\n" +
                                   "Volume".ToLocalizationString() + ":\r\n" +
                                   "Sell Price".ToLocalizationString() + ":\r\n\r\n" +
                                   "Attack".ToLocalizationString() + ":\r\n" +
                                   "Durability".ToLocalizationString() + ":\r\n\r\n";

                m_AttrValues.text = "Object".ToLocalizationString() + "\r\n" +
                                    VCUtils.WeightToString(attr.m_Weight) + "\r\n" +
                                    VCUtils.VolumeToString(attr.m_Volume) + "\r\n" +
                                    (attr.m_SellPrice).ToString("#,##0") +
#if PLANET_EXPLORERS
                                    " " + "Meat".ToLocalizationString() +
#endif
                                    "\r\n\r\n" +
                                    (attr.m_Attack).ToString("#,##0") + " /s\r\n" +
                                    (attr.m_Durability).ToString("#,##0") + "\r\n";
            }
            else if (attr.m_Type == ECreation.AITurret)
            {
                m_AttrNames.text = "Creation".ToLocalizationString() + ":\r\n" +
                                   "Weight".ToLocalizationString() + ":\r\n" +
                                   "Volume".ToLocalizationString() + ":\r\n" +
                                   "Sell Price".ToLocalizationString() + ":\r\n\r\n" +
                                   "Attack".ToLocalizationString() + ":\r\n" +
                                   "Durability".ToLocalizationString() + ":\r\n\r\n";

                m_AttrValues.text = "Object".ToLocalizationString() + "\r\n" +
                                    VCUtils.WeightToString(attr.m_Weight) + "\r\n" +
                                    VCUtils.VolumeToString(attr.m_Volume) + "\r\n" +
                                    (attr.m_SellPrice).ToString("#,##0") +
#if PLANET_EXPLORERS
                                    " " + "Meat".ToLocalizationString() +
#endif
                                    "\r\n\r\n" +
                                    (attr.m_Attack).ToString("#,##0") + " /s\r\n" +
                                    (attr.m_Durability).ToString("#,##0") + "\r\n";
            }
            else if (attr.m_Type == ECreation.ArmorHead ||
                     attr.m_Type == ECreation.ArmorBody ||
                     attr.m_Type == ECreation.ArmorArmAndLeg ||
                     attr.m_Type == ECreation.ArmorHandAndFoot ||
                     attr.m_Type == ECreation.ArmorDecoration)
            {
                m_AttrNames.text = "Creation".ToLocalizationString() + ":\r\n" +
                                   "Weight".ToLocalizationString() + ":\r\n" +
                                   "Volume".ToLocalizationString() + ":\r\n" +
                                   "Sell Price".ToLocalizationString() + ":\r\n\r\n" +
                                   "Defense".ToLocalizationString() + ":\r\n" +
                                   "Durability".ToLocalizationString() + ":\r\n\r\n";

                m_AttrValues.text = "Object".ToLocalizationString() + "\r\n" +
                                    VCUtils.WeightToString(attr.m_Weight) + "\r\n" +
                                    VCUtils.VolumeToString(attr.m_Volume) + "\r\n" +
                                    (attr.m_SellPrice).ToString("#,##0") +
#if PLANET_EXPLORERS
                                    " " + "Meat".ToLocalizationString() +
#endif
                                    "\r\n\r\n" +
                                    (attr.m_Defense).ToString("#,##0") + "\r\n" +
                                    (attr.m_Durability).ToString("#,##0") + "\r\n";
            }
            else
            {
                m_AttrNames.text = "Creation".ToLocalizationString() + ":\r\n" +
                                   "Weight".ToLocalizationString() + ":\r\n" +
                                   "Volume".ToLocalizationString() + ":\r\n" +
                                   "Sell Price".ToLocalizationString() + ":\r\n";

                m_AttrValues.text = "[FF0000]???[-]\r\n" +
                                    VCUtils.WeightToString(attr.m_Weight) + "\r\n" +
                                    VCUtils.VolumeToString(attr.m_Volume) + "\r\n" +
                                    (attr.m_SellPrice).ToString("#,##0") +
        #if PLANET_EXPLORERS
                                    " " + "Meat".ToLocalizationString() +
        #endif
                                    "\r\n";
            }

            if (attr.m_Errors.Count > 0)
            {
                m_AttrNames.text += "\r\n[FF0000]" + "Errors".ToLocalizationString() + ":\r\n";
                foreach (string e in attr.m_Errors)
                {
                    m_AttrNames.text += ("> " + e.ToLocalizationString() + "\r\n");
                }
                m_AttrNames.text += "[-]";
            }
            if (attr.m_Warnings.Count > 0)
            {
                m_AttrNames.text += "\r\n[FFFF00]" + "Warnings".ToLocalizationString() + ":\r\n";
                foreach (string w in attr.m_Warnings)
                {
                    m_AttrNames.text += ("> " + w.ToLocalizationString() + "\r\n");
                }
                m_AttrNames.text += "[-]";
            }
            m_CostList.RefreshCostList();
            m_UITable.Reposition();
        }
        else            // attr == null
        {
            m_AttrNames.text  = "[FF0000]" + m_NonEditorError + "[-]";
            m_AttrValues.text = "";
            m_CostList.RefreshCostList();
            m_UITable.Reposition();
        }

        // Status
        if (m_IsEditor)
        {
            if (VCEditor.s_Scene.m_CreationAttr.m_Errors.Count > 0)
            {
                VCEStatusBar.ShowText("Your creation has some errors".ToLocalizationString(), Color.red, 10);
            }
            else if (VCEditor.s_Scene.m_CreationAttr.m_Warnings.Count > 0)
            {
                VCEStatusBar.ShowText("Your creation has some warnings".ToLocalizationString(), Color.yellow, 10);
            }

            if (attr.m_Weight > 0.0001f)
            {
                VCEditor.Instance.m_MassCenterTrans.localPosition = attr.m_CenterOfMass;
                VCEditor.Instance.m_MassCenterTrans.gameObject.SetActive(true);
            }
            else
            {
                VCEditor.Instance.m_MassCenterTrans.gameObject.SetActive(false);
            }

            VCIsoRemark remark = new VCIsoRemark();
            remark.m_Attribute = attr;
            VCEditor.s_Scene.m_IsoData.m_HeadInfo.Remarks = remark.xml;
        }
    }