Пример #1
0
    static bool DoSanityCheckWeaponMod(WeaponContentMod weaponMod)
    {
        bool ok = true;

        foreach (WeaponManager.WeaponEntry entry in weaponMod.weaponEntries)
        {
            ok &= DoSanityCheckWeaponEntry(entry);
        }

        return(ok);
    }
Пример #2
0
    static bool DoSanityCheckContentReturnable()
    {
        Debug.Log("Running content mod sanity check");

        ClearLog();

        GameObject contentModObject = Selection.activeGameObject;

        if (contentModObject == null)
        {
            Log("No content mod prefab selected");
            return(false);
        }

        if (contentModObject.name == "Example Weapon Content Mod" || contentModObject.name == "Example Vehicle Content Mod")
        {
            Log("Please make a duplicate of the Example Content Mod prefab and name it something original to your mod!");
            return(false);
        }

        Object prefab = PrefabUtility.GetPrefabObject(contentModObject);

        if (prefab == null || contentModObject.scene.IsValid())
        {
            Log("Selected object is not a prefab");
            return(false);
        }

        if (!ContentExporter.IsContentModObject(contentModObject))
        {
            Log("Selected prefab does not contain any Content Mod component");
            return(false);
        }

        WeaponContentMod  weaponMod  = contentModObject.GetComponent <WeaponContentMod>();
        VehicleContentMod vehicleMod = contentModObject.GetComponent <VehicleContentMod>();

        bool ok = true;

        if (weaponMod != null)
        {
            ok &= DoSanityCheckWeaponMod(weaponMod);
        }

        if (vehicleMod != null)
        {
            ok &= DoSanityCheckVehicleMod(vehicleMod);
        }

        return(ok);
    }
Пример #3
0
    void SetupItemTags()
    {
        this.steamworks.currentItem.tags = new List <string>();

        bool            hasWeaponContent  = false;
        bool            hasVehicleContent = false;
        List <FileInfo> gameContentFiles  = this.stagedContent.GetGameContent();

        foreach (FileInfo gameContentFile in gameContentFiles)
        {
            try {
                AssetBundle bundle        = AssetBundle.LoadFromFile(gameContentFile.FullName);
                GameObject  contentObject = bundle.LoadAsset <GameObject>(bundle.GetAllAssetNames()[0]);

                if (!hasWeaponContent)
                {
                    WeaponContentMod weaponContentMod = contentObject.GetComponent <WeaponContentMod>();

                    if (weaponContentMod != null && weaponContentMod.weaponEntries.Count > 0)
                    {
                        hasWeaponContent = true;
                    }
                }

                if (!hasVehicleContent)
                {
                    VehicleContentMod vehicleContentMod = contentObject.GetComponent <VehicleContentMod>();

                    if (vehicleContentMod != null)
                    {
                        hasVehicleContent = true;
                    }
                }

                bundle.Unload(true);
            }
            catch (System.Exception) {}

            //if(hasWeaponContent && hasVehicleContent) {
            if (hasWeaponContent)
            {
                break;
            }
        }

        if (this.stagedContent.HasGameContent())
        {
            this.steamworks.currentItem.tags.Add("Modded Content");
        }

        if (hasWeaponContent)
        {
            this.steamworks.currentItem.tags.Add("Weapons");
        }

        if (hasVehicleContent)
        {
            this.steamworks.currentItem.tags.Add("Vehicles");
        }

        /*if(hasVehicleContent) {
         *      this.steamworks.currentItem.tags.Add("Vehicles");
         * }*/

        if (this.stagedContent.GetMaps().Count > 0)
        {
            this.steamworks.currentItem.tags.Add("Maps");
        }
    }