Skip to content

Commit

Permalink
Rename EstimatePrefab to ValidateCanCreatePrefab, rename template dir…
Browse files Browse the repository at this point in the history
…ectory from ScriptSample to ScriptTemplate
  • Loading branch information
hiroki-o committed Aug 17, 2016
1 parent 8056a03 commit 2d5fb0f
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class AssetBundleGraphSettings {
public const string ASSETS_PATH = "Assets/";
public const string ASSETBUNDLEGRAPH_PATH = ASSETS_PATH + "AssetBundleGraph/";
public const string APPLICATIONDATAPATH_CACHE_PATH = ASSETBUNDLEGRAPH_PATH + "Cache/";
public const string SCRIPTSAMPLE_PATH = ASSETBUNDLEGRAPH_PATH + "Editor/ScriptSample/";
public const string SCRIPT_TEMPLATE_PATH = ASSETBUNDLEGRAPH_PATH + "Editor/ScriptTemplate/";
public const string USERSPACE_PATH = ASSETBUNDLEGRAPH_PATH + "Generated/Editor/";

public const string PREFABRICATOR_CACHE_PLACE = APPLICATIONDATAPATH_CACHE_PATH + "Prefabricated";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void Setup (string nodeName, string nodeId, string labelToNext, Dictionar
return newPrefabOutputPath;
};

EstimatePrefab(nodeName, nodeId, groupKey, assets, recommendedPrefabPath, Prefabricate);
ValidateCanCreatePrefab(nodeName, nodeId, groupKey, assets, recommendedPrefabPath, Prefabricate);

if (!isPrefabricateFunctionCalled) {
Debug.LogWarning(nodeName +": Prefabricate delegate was not called. Prefab might not be created properly.");
Expand Down Expand Up @@ -238,14 +238,14 @@ add current resources to next node's resources.

private bool isPrefabricateFunctionCalled = false;

public virtual void EstimatePrefab (string nodeName, string nodeId, string groupKey, List<AssetInfo> sources, string recommendedPrefabOutputDir, Func<string, string> Prefabricate) {
Debug.LogError(nodeName + ":Subclass did not implement \"EstimatePrefab ()\" method:" + this);
throw new NodeException(nodeName + ":Subclass did not implement \"EstimatePrefab ()\" method:" + this, nodeId);
public virtual void ValidateCanCreatePrefab (string nodeName, string nodeId, string groupKey, List<AssetInfo> sources, string recommendedPrefabOutputDir, Func<string, string> Prefabricate) {
Debug.LogError(nodeName + ":Subclass did not implement \"ValidateCanCreatePrefab ()\" method:" + this);
throw new NodeException(nodeName + ":Subclass did not implement \"ValidateCanCreatePrefab ()\" method:" + this, nodeId);
}

public virtual void CreatePrefab (string nodeName, string nodeId, string groupKey, List<AssetInfo> sources, string recommendedPrefabOutputDir, Func<GameObject, string, bool, string> Prefabricate) {
Debug.LogError(nodeName + ":Subclass did not implement \"CreatePrefab ()\" method:" + this);
throw new NodeException(nodeName + ":Subclass did not implement \"EstimatePrefab ()\" method:" + this, nodeId);
throw new NodeException(nodeName + ":Subclass did not implement \"ValidateCanCreatePrefab ()\" method:" + this, nodeId);
}


Expand Down
4 changes: 2 additions & 2 deletions Assets/AssetBundleGraph/Editor/GUI/AssetBundleGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ public static void GenerateScript (ScriptType scriptType) {

switch (scriptType) {
case ScriptType.SCRIPT_PREFABRICATOR: {
sourceFileName = FileController.PathCombine(AssetBundleGraphSettings.SCRIPTSAMPLE_PATH, "MyPrefabricator.cs.sample");
sourceFileName = FileController.PathCombine(AssetBundleGraphSettings.SCRIPT_TEMPLATE_PATH, "MyPrefabricator.cs.template");
destinationPath = FileController.PathCombine(destinationBasePath, "MyPrefabricator.cs");
break;
}
case ScriptType.SCRIPT_FINALLY: {
sourceFileName = FileController.PathCombine(AssetBundleGraphSettings.SCRIPTSAMPLE_PATH, "MyFinally.cs.sample");
sourceFileName = FileController.PathCombine(AssetBundleGraphSettings.SCRIPT_TEMPLATE_PATH, "MyFinally.cs.template");
destinationPath = FileController.PathCombine(destinationBasePath, "MyFinally.cs");
break;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using UnityEngine;
using UnityEditor;

using System;
using System.Collections.Generic;

public class MyPrefabricator : AssetBundleGraph.PrefabricatorBase {
public override void ValidateCanCreatePrefab (string nodeName, string nodeId, string groupKey, List<AssetBundleGraph.AssetInfo> source, string recommendedPrefabOutputDir, Func<string, string> Prefabricate) {
// Test and see if Prefab can be created
// use Prefabricate deledate to create prefab.
}

public override void CreatePrefab (string nodeName, string nodeId, string groupKey, List<AssetBundleGraph.AssetInfo> source, string recommendedPrefabOutputDir, Func<GameObject, string, bool, string> Prefabricate) {
// use Prefabricate deledate to create prefab.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Drag & Drop this C# script to AssetBundleGraph.
*/
public class CreateCharacterPrefab : AssetBundleGraph.PrefabricatorBase {
public override void EstimatePrefab (string nodeName, string nodeId, string groupKey, List<AssetBundleGraph.AssetInfo> source, string recommendedPrefabOutputDir, Func<string, string> Prefabricate) {
public override void ValidateCanCreatePrefab (string nodeName, string nodeId, string groupKey, List<AssetBundleGraph.AssetInfo> source, string recommendedPrefabOutputDir, Func<string, string> Prefabricate) {
var prefabName = groupKey + "_chara.prefab";
Prefabricate(prefabName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class SamplePrefabricator : AssetBundleGraph.PrefabricatorBase {

public override void EstimatePrefab (string nodeName, string nodeId, string groupKey, List<AssetBundleGraph.AssetInfo> sources, string recommendedPrefabOutputDir, Func<string, string> Prefabricate) {
public override void ValidateCanCreatePrefab (string nodeName, string nodeId, string groupKey, List<AssetBundleGraph.AssetInfo> sources, string recommendedPrefabOutputDir, Func<string, string> Prefabricate) {
if( sources.Count < 3 ) {
throw new AssetBundleGraph.NodeException("SamplePrefabricator needs at least 3 assets to create Prefab.", nodeId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Collections.Generic;

public class SamplePrefabricator2 : AssetBundleGraph.PrefabricatorBase {
public override void EstimatePrefab (string nodeName, string nodeId, string groupKey, List<AssetBundleGraph.AssetInfo> sources, string recommendedPrefabOutputDir, Func<string, string> Prefabricate) {
public override void ValidateCanCreatePrefab (string nodeName, string nodeId, string groupKey, List<AssetBundleGraph.AssetInfo> sources, string recommendedPrefabOutputDir, Func<string, string> Prefabricate) {
if( sources.Count < 4 ) {
throw new AssetBundleGraph.NodeException("SamplePrefabricator2 needs at least 4 assets to create Prefab.", nodeId);
}
Expand Down

0 comments on commit 2d5fb0f

Please sign in to comment.