本文整理汇总了C#中ResourceType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ResourceType.ToString方法的具体用法?C# ResourceType.ToString怎么用?C# ResourceType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResourceType
的用法示例。
在下文中一共展示了ResourceType.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetToResource
public void SetToResource(ResourceType lootType)
{
_resourceType = lootType;
resourceNameDisplay.text = lootType.ToString();
UpdateDisplay();
}
示例2: Resource
int weightValue; // The weight value of the resource
#endregion Fields
#region Constructors
// Create a resource
public Resource(string itemName, ResourceType itemType, Sprite itemIcon, int weight, int size, int worth)
: base(itemName, itemType.ToString(), itemIcon)
{
// Initialise the item to the given parameters
weightValue = weight;
sizeValue = size;
sellValue = worth;
}
示例3: GetResourcePath
private static string GetResourcePath(string path, ResourceType type, ResourceLocation loc)
{
if (path.StartsWith("/")) {
path = path.Substring(1);
}
return string.Format("{0}{1}/{2}"
, loc == ResourceLocation.Module ? ModuleFolder : ThemeFolder
, type.ToString()
, path
);
}
示例4: GetResourcesByType
// Get all the resources of a given type
public List<Resource> GetResourcesByType(ResourceType resourceType, int playerNum)
{
// The list to return; returns empty list if the inventory doesn't exist
List<Resource> resources = new List<Resource>();
// Get the inventory script
Inventory inventory = GameObject.Find("Canvas").transform.Find("Inventory").GetComponent<Inventory>();
// Make sure the inventory exists
if (inventory != null)
{
// Set the inventory up for the correct player
inventory.SetPlayer(playerNum, true);
// Get all the items in the inventory
List<Item> inventoryItems = inventory.GetItems(playerNum);
// Find all the resources of the given type
resources = inventoryItems.FindAll(tempItem => tempItem.Type == resourceType.ToString()).Select(item => (Resource)item).ToList();
} // end if
// Return the list of resources
return resources;
}
示例5: Move
/// <summary>
/// 演绎函数:移动图片
/// </summary>
/// <param name="id">图片ID</param>
/// <param name="rType">资源类型</param>
/// <param name="property">改变的属性</param>
/// <param name="toValue">目标值</param>
/// <param name="acc">加速度</param>
/// <param name="duration">完成所需时间</param>
private void Move(int id, ResourceType rType, string property, double toValue, double acc, Duration duration)
{
YuriSprite actionSprite = this.viewMana.GetSprite(id, rType);
SpriteDescriptor descriptor = Director.ScrMana.GetSpriteDescriptor(id, rType);
if (actionSprite == null)
{
CommonUtils.ConsoleLine(String.Format("Ignored move (sprite is null): {0}, {1}", rType.ToString(), id),
"UpdateRender", OutputStyle.Warning);
return;
}
switch (property)
{
case "x":
SpriteAnimation.XYMoveToAnimation(actionSprite, duration, toValue, actionSprite.DisplayY, acc, 0);
descriptor.X = toValue;
break;
case "y":
SpriteAnimation.XYMoveToAnimation(actionSprite, duration, actionSprite.DisplayX, toValue, 0, acc);
descriptor.Y = toValue;
break;
case "o":
case "opacity":
SpriteAnimation.OpacityToAnimation(actionSprite, duration, toValue, acc);
descriptor.Opacity = toValue;
break;
case "a":
case "angle":
SpriteAnimation.RotateToAnimation(actionSprite, duration, toValue, acc);
descriptor.Angle = toValue;
break;
case "s":
case "scale":
SpriteAnimation.ScaleToAnimation(actionSprite, duration, toValue, toValue, acc, acc);
descriptor.ScaleX = descriptor.ScaleY = toValue;
break;
case "sx":
case "scalex":
SpriteAnimation.ScaleToAnimation(actionSprite, duration, toValue, descriptor.ScaleY, acc, 0);
descriptor.ScaleX = toValue;
break;
case "sy":
case "scaley":
SpriteAnimation.ScaleToAnimation(actionSprite, duration, descriptor.ScaleX, toValue, 0, acc);
descriptor.ScaleY = toValue;
break;
default:
CommonUtils.ConsoleLine(String.Format("Move instruction without valid parameters: {0}", property),
"UpdateRender", OutputStyle.Warning);
break;
}
}
示例6: FindWebhookResource
/// <summary>
/// Find specific webhook resource
/// </summary>
/// <param name="resource">resource type object</param>
/// <returns>WebhookResource object</returns>
/// <exception cref="BadRequestException"> in case HTTP response code is 400 - Bad request, the request was formatted improperly.</exception>
/// <exception cref="UnauthorizedException"> in case HTTP response code is 401 - Unauthorized, API Key missing or invalid.</exception>
/// <exception cref="AccessForbiddenException"> in case HTTP response code is 403 - Forbidden, insufficient permissions.</exception>
/// <exception cref="ResourceNotFoundException"> in case HTTP response code is 404 - NOT FOUND, the resource requested does not exist.</exception>
/// <exception cref="InternalServerErrorException"> in case HTTP response code is 500 - Internal Server Error.</exception>
/// <exception cref="CallfireApiException"> in case HTTP response code is something different from codes listed above.</exception>
/// <exception cref="CallfireClientException"> in case error has occurred in client.</exception>
public WebhookResource FindWebhookResource(ResourceType resource, string fields)
{
var queryParams = ClientUtils.BuildQueryParams("fields", fields);
return Client.Get<WebhookResource>(WEBHOOKS_RESOURCE_PATH.ReplaceFirst(ClientConstants.PLACEHOLDER, resource.ToString()), queryParams);
}
示例7: getResourcePools
public static ManagementObjectCollection getResourcePools(ResourceType ResourceType, string ResourceSubtype, string PoolId, ManagementScope Scope)
{
var myType = (int)ResourceType;
Console.WriteLine("ResourceType : " + ResourceType.ToString());
return getManagementObjects(wmiClass.CIM_ResourcePool.ToString(), ResourceType, ResourceSubtype, PoolId, Scope);
}
示例8: InsufficientResources
public void InsufficientResources(ResourceType type)
{
Debug.Log(string.Format("{0} has insufficient {1}", name, type.ToString()));
}
示例9: UploadResourceAndGetInfoAsync
private async Task<JobResource> UploadResourceAndGetInfoAsync(string filePath, ResourceType resourceType, string driverUploadPath, string localizedName = null)
{
if (!_file.Exists(filePath))
{
Exceptions.Throw(
new FileNotFoundException("Could not find resource file " + filePath),
Log);
}
var detailsOutputPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
try
{
await _javaLauncher.LaunchAsync(JavaClassNameForResourceUploader,
filePath,
resourceType.ToString(),
driverUploadPath,
detailsOutputPath);
var localizedResourceName = localizedName ?? Path.GetFileName(filePath);
return ParseGeneratedOutputFile(detailsOutputPath, localizedResourceName, resourceType);
}
finally
{
if (_file.Exists(detailsOutputPath))
{
_file.Delete(detailsOutputPath);
}
}
}
示例10: AddResource
public void AddResource(ResourceType collectedResource)
{
switch (collectedResource)
{
case ResourceType.Skull:
SoundMan.main.ResourceCollectSkull();
break;
case ResourceType.Feather:
SoundMan.main.ResourceCollectRaven();
break;
case ResourceType.Fire:
SoundMan.main.ResourceCollectFireball();
//play sound
break;
case ResourceType.Pyramid:
SoundMan.main.ResourceCollectTriangle();
//play sound
break;
}
if (gameOver) return;
Debug.Log ("in addResource " + collectedResource.ToString());
Debug.Log ("Needed resource: " + neededResource);
if (collectedResource == sequencer.inputArray[colorsScored])
{
Debug.Log ("got needed color");
currentResourceTotal++;
Debug.Log ("currentResource count " + currentResourceTotal);
if (currentResourceTotal >= maxResources)
{
currentResourceTotal = 0;
Debug.Log ("Reset resources to : " + currentResourceTotal);
resourceDisplay [colorsScored].SetResourceIcon (collectedResource);
ColorScored();
}
}
}
示例11: UpdateMedatadaFile
/// <summary>
/// Update the metadata file with resource status IsImported
/// </summary>
/// <param name="resourceType">Type of resource to be updated in metadata file</param>
/// <param name="resourceName">Name of the resource</param>
/// <param name="isImported">If reource is imported successfully</param>
/// <param name="parentResourceName">Name of parent resource</param>
internal void UpdateMedatadaFile(ResourceType resourceType, string resourceName = null, bool isImported = true, string parentResourceName = null)
{
string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
Logger.Info(methodName, ProgressResources.ExecutionStarted, resourceType.ToString(), resourceName);
foreach (DataCenter dataCenter in sourceSubscriptionMetadata.DataCenters)
{
switch (resourceType)
{
case ResourceType.AffinityGroup:
{
// For Affinity Group
dataCenter.AffinityGroups = dataCenter.AffinityGroups.Select(affinityGroup =>
{
if (affinityGroup.AffinityGroupDetails.Name.Equals(GetSourceResourceName(ResourceType.AffinityGroup, resourceName),
StringComparison.InvariantCultureIgnoreCase))
{
affinityGroup.IsImported = isImported;
}
return affinityGroup;
}).ToList();
}
break;
case ResourceType.NetworkConfiguration:
{
// For Network Configuration
if (dataCenter.NetworkConfiguration != null)
{
dataCenter.NetworkConfiguration.IsImported = isImported;
}
}
break;
case ResourceType.StorageAccount:
{
// For Storage Account
dataCenter.StorageAccounts = dataCenter.StorageAccounts.Select(storageAccount =>
{
if (storageAccount.StorageAccountDetails.Name.Equals(GetSourceResourceName(ResourceType.StorageAccount, resourceName),
StringComparison.InvariantCultureIgnoreCase))
{
storageAccount.IsImported = isImported;
}
return storageAccount;
}).ToList();
}
break;
case ResourceType.CloudService:
{
// For Cloud Service
dataCenter.CloudServices = dataCenter.CloudServices.Select(service =>
{
if (service.CloudServiceDetails.ServiceName.Equals(GetSourceResourceName(ResourceType.CloudService, resourceName),
StringComparison.InvariantCultureIgnoreCase))
{
service.IsImported = isImported;
}
return service;
}).ToList();
}
break;
case ResourceType.Deployment:
{
// For Deployment
dataCenter.CloudServices = dataCenter.CloudServices.Select(service =>
{
if (service.DeploymentDetails != null &&
service.DeploymentDetails.Name.Equals(GetSourceResourceName(ResourceType.Deployment, resourceName,
ResourceType.CloudService, parentResourceName),
StringComparison.InvariantCultureIgnoreCase)
&& service.CloudServiceDetails.ServiceName.
Equals(GetSourceResourceName(ResourceType.CloudService, parentResourceName)))
{
service.DeploymentDetails.IsImported = isImported;
}
return service;
}).ToList();
}
break;
case ResourceType.VirtualMachine:
{
// For Virtual Machine
dataCenter.CloudServices = dataCenter.CloudServices.Select(service =>
{
if (service.DeploymentDetails != null && service.CloudServiceDetails.ServiceName.
Equals(GetSourceResourceName(ResourceType.CloudService, parentResourceName)))
{
service.DeploymentDetails.VirtualMachines = service.DeploymentDetails.VirtualMachines.Select(vm =>
{
if (vm.VirtualMachineDetails.RoleName.Equals(
GetSourceResourceName(ResourceType.VirtualMachine, resourceName,
ResourceType.CloudService, parentResourceName),
// resourceName,
//.........这里部分代码省略.........
示例12: SearchParameters
protected SearchParameters(ResourceType resourceType)
{
Type = resourceType.ToString().ToLower();
Page = 1;
}
示例13: ResourceNotLoadedException
public ResourceNotLoadedException(int resourceID, ResourceType resourceType) : base("Could not locate resource id '" + resourceID + "', of type '" + resourceType.ToString() + "'.")
{
}
示例14: GetCollectionName
public static string GetCollectionName(ResourceType t)
{
return t.ToString().ToLower();
}
示例15: GenerateNewResourceName
/// <summary>
/// Generates new name for destination resources by attaching Prefix to source resources.
/// </summary>
/// <param name="resourceType">Resource type</param>
/// <param name="originalResourceName">Source subscription resource name</param>
/// <param name="destinationPrefixValue">Prefix value for destination name</param>
/// <param name="updateCollection">True to update the internal collection of resource names</param>
/// <returns>Prefix attached value</returns>
private string GenerateNewResourceName(ResourceType resourceType, string originalResourceName,
string destinationPrefixValue, bool updateCollection = true)
{
if (originalResourceName == null)
{
return null;
}
else
{
string newResourceName = string.Format("{0}{1}", destinationPrefixValue, originalResourceName);
if (resourceType != ResourceType.None)
{
newResourceName = ((Constants.GetMaxLengthForResourceType(resourceType) != -1 && (newResourceName.Length > Constants.GetMaxLengthForResourceType(resourceType))?
newResourceName.Substring(0, Constants.GetMaxLengthForResourceType(resourceType) - 1) :
newResourceName));
if (updateCollection)
{
if (resourceNameCollection.ContainsKey(resourceType) && resourceNameCollection[resourceType].Count() > 0)
{
if (resourceNameCollection[resourceType].Where(s => s.SourceName.Equals(originalResourceName)).Count() == 0)
resourceNameCollection[resourceType].Add(new ResourceNameMapper
{
SourceName = originalResourceName,
DestinationName = newResourceName,
//Import = true,
ResourceType = resourceType.ToString()
});
}
else
{
List<ResourceNameMapper> resourceNames = new List<ResourceNameMapper>();
resourceNames.Add(new ResourceNameMapper
{
SourceName = originalResourceName,
DestinationName = newResourceName,
//Import = true,
ResourceType = resourceType.ToString()
});
resourceNameCollection.Add(resourceType, resourceNames);
}
}
}
return newResourceName;
}
}