本文整理汇总了C#中Resources类的典型用法代码示例。如果您正苦于以下问题:C# Resources类的具体用法?C# Resources怎么用?C# Resources使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Resources类属于命名空间,在下文中一共展示了Resources类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Block
public Block(Resources.BlockRegistry.BlockTypes type,Block[,] grid,short x,short y)
{
this.Type = type;
Grid = grid;
X = x;
Y = y;
}
示例2: StaticImage
public StaticImage(Resources resources, int id)
{
mBitmap = BitmapDrawable.Create(resources, id);
ShouldBeEjected = false;
DrawThread.StaticLayer.Add(this);
}
示例3: Terrain
public Terrain(Backend backend, TerrainData data, int chunks, int resolution, Resources.Material material, Resources.Material compositeMaterial)
{
if (backend == null)
throw new ArgumentNullException("backend");
if (data == null)
throw new ArgumentNullException("data");
Backend = backend;
Data = data;
var chunkSize = new Vector2(data.WorldSize.X, data.WorldSize.Z) / (float)chunks;
// Setup the chunks
for (var y = 0; y < chunks; y++)
{
for (var x = 0; x < chunks; x++)
{
var chunkPosition = new Vector2(chunkSize.X * x, chunkSize.Y * y);
var chunk = new Chunk(this, chunkPosition, chunkSize, resolution, chunks);
// TODO: Setup correct materials per chunk so that we can have different splatmaps etc ...
chunk.Mesh.Material = material;
chunk.SplatMaterial = material;
chunk.CompositeMaterial = compositeMaterial;
Chunks.Add(chunk);
}
}
Mesh = new Resources.Mesh("terrain", "");
Mesh.SubMeshes = Chunks.Select(c => c.Mesh).ToArray();
Mesh.State = Common.ResourceLoadingState.Loaded;
}
示例4: Index
//
// GET: /Resources/
public ActionResult Index()
{
List<Resources> pt = new List<Resources>();
MySqlConnection myConn;
MySqlDataReader dataReader;
myConn = new MySqlConnection(TaqtiController.connectionString);
myConn.Open();
MySqlCommand cmd = new MySqlCommand(TaqtiController.connectionString);
cmd = myConn.CreateCommand();
cmd.CommandText = "select * from Resources order by date DESC";
dataReader = cmd.ExecuteReader();
while (dataReader.Read())
{
Resources p = new Resources();
p.id = dataReader.GetInt32(0);
p.title = dataReader.GetString(1);
p.text = dataReader.GetString(2);
p.author = dataReader.GetString(3);
p.date = dataReader.GetDateTime(4);
p.category = dataReader.GetString(5);
p.website = dataReader.GetString(6);
pt.Add(p);
}
myConn.Close();
return View(pt);
}
示例5: Initialize
public static void Initialize(Resources resources)
{
const string sectionName = UrlsConfiguration.SectionName;
var routingConfiguration = ConfigurationServices.ConfigurationSource.GetSection(sectionName) as UrlsConfiguration;
Verify.IsNotNull(routingConfiguration, "Config section '{0}' is missing", sectionName);
var factory = new UrlFormatterFactory();
var formatters = new List<Tuple<IUrlFormatter, bool>>();
var urlFormattersConfigNode = routingConfiguration.UrlFormatters;
if (urlFormattersConfigNode != null)
{
foreach (var urlFormatterData in urlFormattersConfigNode)
{
string name = urlFormatterData.Name;
try
{
formatters.Add(new Tuple<IUrlFormatter, bool>(factory.Create(name), urlFormatterData.Mandatory));
}
catch(Exception ex)
{
Log.LogError(LogTitle, "Failed to load url formatter '{0}'", name);
Log.LogError(LogTitle, ex);
}
}
}
resources.UrlFormatters = formatters;
}
示例6: Article
public ActionResult Article(int id)
{
Resources pt = new Resources();
MySqlConnection myConn;
MySqlDataReader dataReader;
myConn = new MySqlConnection(TaqtiController.connectionString);
myConn.Open();
MySqlCommand cmd = new MySqlCommand(TaqtiController.connectionString);
cmd = myConn.CreateCommand();
cmd.CommandText = "select * from Resources where id = @id;";
cmd.Parameters.AddWithValue("@id",id);
dataReader = cmd.ExecuteReader();
while (dataReader.Read())
{
pt.id = dataReader.GetInt32(0);
pt.title = dataReader.GetString(1);
pt.text = dataReader.GetString(2);
pt.author = dataReader.GetString(3);
pt.date = dataReader.GetDateTime(4);
pt.category = dataReader.GetString(5);
pt.website = dataReader.GetString(6);
pt.keywords = dataReader.GetString(7);
}
myConn.Close();
return View(pt);
}
示例7: Ship
public Ship(Resources resources, int id, double maxVelocity, double maxAcceleration, double angularVelocity)
: base(BitmapDrawable.Create(resources, id))
{
Velocity.Max = maxVelocity;
MaxAcceleration = maxAcceleration;
AngularVelocity = angularVelocity;
}
示例8: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Suit);
Type = Intent.GetIntExtra("SuitType", -1);
Res = this.Resources;
switch (Type)
{
case 1:
LoadHighArkan();
break;
case 2:
LoadCupSuit();
break;
case 3:
LoadSwordSuit();
break;
case 4:
LoadPentacle();
break;
case 5:
LoadStaff();
break;
default:
break;
}
}
示例9: Start
void Start()
{
zasoby = gameObject.GetComponent<Resources>();
zasoby.like = 0;
zasoby.tweet = 0;
zasoby.snap = 0;
}
示例10: GetIconDrawable
public Drawable GetIconDrawable(Resources res, PwDatabase db, PwIcon icon, PwUuid customIconId)
{
if (!customIconId.Equals(PwUuid.Zero)) {
return GetIconDrawable (res, db, customIconId);
}
return GetIconDrawable (res, icon);
}
示例11: DoInitializeResources
public static void DoInitializeResources(Resources resources)
{
if (HasConfiguration())
{
resources.HookRegistratorPluginNames = new List<string>();
IConfigurationSource configurationSource = GetConfiguration();
var settings = configurationSource.GetSection(HookRegistratorSettings.SectionName) as HookRegistratorSettings;
if (settings == null)
{
throw new ConfigurationErrorsException(string.Format("Failed to load the configuration section '{0}' from the configuration", HookRegistratorSettings.SectionName));
}
foreach (HookRegistratorData data in settings.HookRegistratorPlugins)
{
resources.HookRegistratorPluginNames.Add(data.Name);
}
}
else
{
resources.HookRegistratorPluginNames = new List<string>();
}
}
示例12: InitAudioBuffer
public override IAudioBuffer InitAudioBuffer(Resources.Resource handle)
{
var bufferId = AL.GenBuffer();
var sourceId = AL.GenSource();
var reader = new AudioReader(handle.Stream);
//Read
var soundData = reader.ReadToEnd();
AL.BufferData(bufferId, soundData);
var error = AL.GetError();
if (error != ALError.NoError)
{
Logger.Error("Could not read Audio, {0}", error);
return null;
}
var audioBuffer = new OpenAlAudioBuffer(bufferId,sourceId,soundData.Data.Length, handle);
//Prepare
AL.Source(sourceId, ALSourcei.Buffer, (int)bufferId);
//Add
AllSamples.Add(audioBuffer);
return audioBuffer;
}
示例13: ViewBrowser
/// <summary>
/// Initialise the browser.
/// </summary>
/// <param name="view"></param>
public ViewBrowser(Resources.View view)
{
View = view;
InitializeComponent();
foreach (var group in view.Groups) {
string label = group.Index + ". Animation " + group.Animation.Index + (group.IsMirrored ? " (mirrored)" : "");
groupsView.Items.Add(new ListViewItem(label));
}
foreach (var animation in view.Animations) {
string label = animation.Index + ". " + animation.Unknowns.ToCommaSeparatedList() + " " + animation.Cells.Count + " frame" + (animation.Cells.Count == 1 ? "" : "s");
animationsView.Items.Add(new ListViewItem(label));
}
Size smallImageSize = Size.Empty, largeImageSize = Size.Empty;
foreach (ViewCell cell in view.Cells) {
smallImageSize.Width = Math.Max(smallImageSize.Width, cell.Raster.Image.Width);
smallImageSize.Height = Math.Max(smallImageSize.Height, cell.Raster.Image.Height);
largeImageSize.Width = Math.Max(largeImageSize.Width, cell.Raster.Image4x.Width);
largeImageSize.Height = Math.Max(largeImageSize.Height, cell.Raster.Image4x.Height);
}
foreach (ViewCell cell in view.Cells) {
string label = cell.Index + ". ";
if (cell.Offset != Vector2i.Zero)
label += "offset " + cell.Offset.X + "x" + cell.Offset.Y + ", ";
label += "size " + cell.Raster.Width + "x" + cell.Raster.Height;
cellsView.Controls.Add(new ViewBrowserItem(label, cell.Raster.Image4x));
//cellsView.Items.Add(new ListViewItem(label, cell.Index));
}
}
示例14: Awake
public override void Awake() {
base.Awake();
Cost = new Resources {
Stone = 50
};
}
示例15: SummonObject
public GameObject SummonObject(Object toSummon, Vector3 location, bool takeResource = true) {
if (GetComponentInChildren<Ghost>() != null) {
return null;
}
GameObject summonedObject = Instantiate(toSummon, location, Quaternion.identity) as GameObject;
summonedObject.transform.parent = transform;
summonedObject.GetComponent<BasicObject>().Parent = GetComponent<Player>();
summonedObject.GetComponentInChildren<SkinnedMeshRenderer>().enabled = false;
if (takeResource) {
if (summonedObject.GetComponent<BasicObject>().Cost > OwnedResources) {
Destroy(summonedObject);
return null; //TODO add feedback to show that player cannot afford
} else {
if (summonedObject.GetComponent<Building>() == null || !PlayerInfo.IsHuman) {
OwnedResources -= summonedObject.GetComponent<BasicObject>().Cost;
summonedObject.GetComponent<SkinnedMeshRenderer>().enabled = true;
return summonedObject;
} else {
summonedObject.AddComponent<Ghost>();
return summonedObject;
}
}
} else {
summonedObject.GetComponentInChildren<SkinnedMeshRenderer>().enabled = true;
return summonedObject;
}
}