本文整理汇总了C#中AssetManager类的典型用法代码示例。如果您正苦于以下问题:C# AssetManager类的具体用法?C# AssetManager怎么用?C# AssetManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssetManager类属于命名空间,在下文中一共展示了AssetManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IntegrateChild
protected override bool IntegrateChild(AssetManager assets, LayoutTreeNode childNode)
{
switch (childNode.Key)
{
case "Path":
#if DEBUG
if (Convert.ToInt32(childNode.KeyExtension) != Path.Count)
Console.WriteLine("LevelBuilder WARNING: Ribbon path points are not in order.");
#endif
Path.Add(ExtendedConvert.ToVector2(childNode.Value));
return true;
case "Start":
Start = Convert.ToSingle(childNode.Value);
return true;
case "End":
End = Convert.ToSingle(childNode.Value);
return true;
case "Loop":
Loop = Convert.ToBoolean(childNode.Value);
return true;
case "Complete":
Complete = Convert.ToBoolean(childNode.Value);
return true;
}
return false;
}
示例2: AndroidGraphics
public AndroidGraphics(AssetManager am, Bitmap bm)
{
this.assets = am;
this.frameBuffer = bm;
this.canvas = new Canvas (frameBuffer);
this.paint = new Paint ();
}
示例3: AddAsset
public long AddAsset(string title, string filename, long folderId, int languageId, long externalTypeid, byte[] filestream, ContentMetaData[] potentialMeta)
{
try
{
assetManager = new AssetManager();
assetManager.ContentLanguage = languageId;
if (string.IsNullOrEmpty(userauthHeader.AuthenticationToken))
throw new SoapException("User not logged in", SoapException.ClientFaultCode);
this.ImpersonateUser(userauthHeader.AuthenticationToken, assetManager.RequestInformation);
ContentAssetData contentassetdata = new ContentAssetData()
{
FolderId = folderId,
Title = title,
File = filestream,
LanguageId = languageId,
ExternalTypeId = externalTypeid,
AssetData = new AssetData { FileName = filename },
MetaData = potentialMeta
};
return assetManager.Add(contentassetdata).Id;
}
catch (Exception ex)
{
throw new SoapException("Error adding an asset:" + ex.Message, SoapException.ClientFaultCode);
}
}
示例4: TextureArchive
internal TextureArchive(AssetManager manager, BinaryReader reader, string name)
: base(manager, name)
{
ByteOrder = ByteOrder.LittleEndian;
reader.RequireMagic(Magic);
var totalSize = reader.ReadInt32();
var count = reader.ReadInt32();
ByteOrder = ByteOrder.LittleEndian;
int code = reader.ReadInt32();
if (code == 0x20302) {
totalSize = totalSize.ReverseBytes();
count = count.ReverseBytes();
ByteOrder = ByteOrder.BigEndian;
Platform = DSPlatform.PS3;
} else if(code == 0x02030200) { // BigEndianBinaryReader, PS3
Platform = DSPlatform.PS3;
} else if (code != 0x20300)
throw new InvalidDataException();
for (int index = 0; index < count; index++)
new TextureArchiveRecord(this, reader, ByteOrder);
Stream = reader.BaseStream;
}
示例5: PluginAsset
internal PluginAsset(AssetManager manager, ResourceManager resourceManager)
: base(manager, resourceManager)
{
if (!(this is AssetPlugin))
throw new InvalidOperationException();
Plugin = (AssetPlugin)this;
}
示例6: AssetStreamReceiver
public AssetStreamReceiver(AssetManager assets, ByteArrayPool byteArrayPool, string fileName)
{
this.assets = assets;
this.byteArrayPool = byteArrayPool;
this.fileName = fileName;
metadataBuffer = new byte[4];
}
示例7: TestAsyncLoad
public void TestAsyncLoad( )
{
AssetManager assets = new AssetManager( );
assets.AddLoader( new XmlAssetLoader( 10 ) );
using ( AsyncAssetLoader loader = new AsyncAssetLoader( ) )
{
int success = 0;
int numLoads = 8;
AsyncLoadResult[] results = new AsyncLoadResult[ numLoads ];
for ( int loadCount = 0; loadCount < numLoads; ++loadCount )
{
AsyncLoadResult result = loader.QueueLoad( assets, new StreamSource( XmlContent, "test.xml" ), null, LoadPriority.High );
result.AddLoadCompleteCallback(
delegate( object asset )
{
CheckDocument( ( XmlNode )asset );
++success;
},
false );
results[ loadCount ] = result;
}
for ( int loadCount = 0; loadCount < numLoads; ++loadCount )
{
results[ loadCount ].WaitUntilComplete( new TimeSpan( 0, 0, 2 ) );
}
Assert.AreEqual( success, numLoads );
}
}
示例8: Game1
public Game1(AssetManager assets)
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
IsMouseVisible = true;
// Allow users to resize the window, and handle the Projection Matrix on Resize
//Window.Title = "Disentanglement";
//Window.AllowUserResizing = true;
Window.ClientSizeChanged += OnClientSizeChanged;
_puzzleState = PuzzleParser.GetGordionCubePuzzle(assets);
_initialState = _puzzleState;
foreach (var piece in _puzzleState.Pieces)
{
_pieceVisibility[piece.Piece.Name] = true;
}
_pieceKeyMapping[Keys.D1] = "Orange";
_pieceKeyMapping[Keys.D2] = "Blue";
_pieceKeyMapping[Keys.D3] = "Yellow";
_pieceKeyMapping[Keys.D4] = "Red";
_pieceKeyMapping[Keys.D5] = "Green";
_pieceKeyMapping[Keys.D6] = "Purple";
System.Threading.ThreadPool.QueueUserWorkItem(delegate { Solve(); });
}
示例9: SaveManagerDetails
public static int SaveManagerDetails(AssetManagerRecordDetails details)
{
using (IDalSession session = NHSessionFactory.CreateSession())
{
IAssetManager manager = null;
if (details.Key == 0)
{
manager = new AssetManager();
IEffectenGiro stichting = ManagementCompanyMapper.GetEffectenGiroCompany(session);
string tShortName = details.Initials + @" Trading Account";
string tNumber = details.Initials + @"_Trading";
ITradingAccount newTradingAccount = new TradingAccount(tNumber, tShortName, stichting);
manager.TradingAccount = newTradingAccount;
string nShortName = details.Initials + @" Nostro Account";
string nNumber = details.Initials + @"_Nostro";
INostroAccount newNostroAccount = new NostroAccount(nNumber, nShortName, manager);
manager.OwnAccount = newNostroAccount;
manager.StichtingDetails = stichting;
}
else
manager = ManagementCompanyMapper.GetAssetManager(session, details.Key);
manager.CompanyName = details.Name;
manager.Initials = details.Initials;
manager.IsActive = details.IsActive;
manager.SupportLifecycles = details.SupportLifecycles;
session.InsertOrUpdate(manager);
return manager.Key;
}
}
示例10: TestClient
/// <summary>
///
/// </summary>
public TestClient(ClientManager manager)
{
ClientManager = manager;
NewAssetManager = new AssetManager(this);
NewAppearanceManager = new AppearanceManager(this, NewAssetManager);
updateTimer = new System.Timers.Timer(1000);
updateTimer.Elapsed += new System.Timers.ElapsedEventHandler(updateTimer_Elapsed);
RegisterAllCommands(Assembly.GetExecutingAssembly());
Settings.DEBUG = true;
Settings.STORE_LAND_PATCHES = true;
Settings.ALWAYS_REQUEST_OBJECTS = true;
Network.RegisterCallback(PacketType.AgentDataUpdate, new NetworkManager.PacketCallback(AgentDataUpdateHandler));
Objects.OnNewPrim += new ObjectManager.NewPrimCallback(Objects_OnNewPrim);
Objects.OnObjectUpdated += new ObjectManager.ObjectUpdatedCallback(Objects_OnObjectUpdated);
Objects.OnObjectKilled += new ObjectManager.KillObjectCallback(Objects_OnObjectKilled);
Objects.OnNewAvatar += new ObjectManager.NewAvatarCallback(Objects_OnNewAvatar);
Self.OnInstantMessage += new MainAvatar.InstantMessageCallback(Self_OnInstantMessage);
Groups.OnGroupMembers += new GroupManager.GroupMembersCallback(GroupMembersHandler);
this.OnLogMessage += new LogCallback(TestClient_OnLogMessage);
Network.RegisterCallback(PacketType.AvatarAppearance, new NetworkManager.PacketCallback(AvatarAppearanceHandler));
updateTimer.Start();
}
示例11: WorkoutDataAdapter
public WorkoutDataAdapter(AssetManager assets)
{
_assetManager = assets;
var localFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
var localFile = Path.Combine(localFolder, WorkoutFileName);
// Check if user file exists.
if (!File.Exists (localFile))
{
// Check if folder exists.
if (!Directory.Exists(localFolder)) {
Directory.CreateDirectory(localFolder);
}
using (var defaultData = _assetManager.Open("Workouts.xml"))
{
// Save default workouts to folder.
using (var fs = new FileStream(localFile, FileMode.CreateNew, FileAccess.Write))
{
defaultData.CopyTo (fs);
fs.Flush ();
fs.Close ();
}
defaultData.Close ();
}
}
// Now open local file.
var dataStream = new FileStream(localFile, FileMode.Open, FileAccess.Read);
LoadWorkouts (dataStream);
}
示例12: Script
public Script(AssetManager manager, BinaryReader reader, string name)
: base(manager, name)
{
long end = reader.BaseStream.Length;
ExceptionEnd = "";
reader.Require(0x01011388);
CodeAddressA = reader.ReadUInt16();
reader.Require((ushort)0x0101);
CodeAddressB = reader.ReadUInt16();
reader.Require((ushort)0x0101);
CodeAddressC = reader.ReadUInt16();
reader.Require((ushort)0x0101);
CodeAddressD = reader.ReadUInt16();
reader.Require((ushort)0x0101);
CodeAddressE = reader.ReadUInt16();
while (reader.BaseStream.Position < end) {
try {
var instruction = ScriptInstruction.Read(this, reader);
InstructionsMutable.Add(instruction);
} catch (Exception exception) {
ExceptionEnd = string.Format("\r\n{0:X}: Exception: {1}\r\nStopping\r\n", reader.BaseStream.Position, exception);
break;
}
}
Link();
}
示例13: MultiOptionSelector
public MultiOptionSelector(AssetManager assets, string themeName, Vector2 position, Anchor anchor, List<Option> options, MultiOptionArrangement arrangement, Cursor cursor, int initialValue)
: base(themeName, position, initialValue)
{
//process arrangement
if (arrangement == MultiOptionArrangement.ListX)
arrangement = new MultiOptionArrangement(options.Count, 1);
if (arrangement == MultiOptionArrangement.ListY)
arrangement = new MultiOptionArrangement(1, options.Count);
this.arrangement = arrangement;
TextDictionary assetDictionary = new TextDictionary(assets.GetText("selector"));
//load themes
string cursorTheme = assetDictionary.LookupString(themeName, "cursorTheme");
string optionTheme = assetDictionary.LookupString(themeName, "optionTheme");
Anchor justify = Anchor.Center;
bool justifySuccess = assetDictionary.CheckPropertyExists(themeName, "justify");
if (justifySuccess)
{
string justifyString = assetDictionary.LookupString(themeName, "justify");
if (justifyString == "Left")
justify = Anchor.CenterLeft;
else if (justifyString == "Right")
justify = Anchor.CenterRight;
}
//position components
cursor.Initialize(options, assets, cursorTheme);
Vector2 individualSize = Vector2.Zero;
for (int i = 0; i < options.Count; i++)
{
options[i].Initialize(assets, optionTheme);
if (options[i].Dimensions.X > individualSize.X)
individualSize.X = options[i].Dimensions.X;
if (options[i].Dimensions.Y > individualSize.Y)
individualSize.Y = options[i].Dimensions.Y;
}
for (int i = 0; i < options.Count; i++)
options[i].Position = (individualSize + cursor.Spacing * Vector2.One) * arrangement.GetPosition(i);
Vector2 overallSize = new Vector2(arrangement.Columns * (individualSize.X + cursor.Spacing) - cursor.Spacing, arrangement.Rows * (individualSize.Y + cursor.Spacing) - cursor.Spacing);
for (int i = 0; i < options.Count; i++)
{
Vector2 p = options[i].Position;
if (justify == Anchor.TopCenter || justify == Anchor.Center || justify == Anchor.BottomCenter)
p.X += (individualSize.X - options[i].Dimensions.X) / 2;
else if (justify == Anchor.TopRight || justify == Anchor.CenterRight || justify == Anchor.BottomRight)
p.X += individualSize.X - options[i].Dimensions.X;
if (justify == Anchor.CenterLeft || justify == Anchor.Center || justify == Anchor.CenterRight)
p.Y += (individualSize.Y - options[i].Dimensions.Y) / 2;
else if (justify == Anchor.BottomLeft || justify == Anchor.BottomCenter || justify == Anchor.BottomRight)
p.Y += individualSize.Y - options[i].Dimensions.Y;
options[i].Position = p;
}
this.Position -= GraphicsHelper.ComputeAnchorOrigin(anchor, overallSize / GraphicsConstants.VIEWPORT_DIMENSIONS);
this.options = options;
this.cursor = cursor;
//initialize position
Vector2 initialPosition = arrangement.GetPosition(IntValue);
x = (int)initialPosition.X;
y = (int)initialPosition.Y;
cursor.Update(IntValue);
}
示例14: GetLocationsFromCsvFile
internal static List<LocationItem> GetLocationsFromCsvFile(AssetManager assets)
{
if (LocationItems.Any())
return LocationItems;
using (var sr = new StreamReader(assets.Open("TopWorldCities.csv")))
{
var x = sr.ReadToEnd();
var position = 0;
foreach ( var line in x.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None))
{
try
{
var objectItems = line.Split(';');
if (objectItems.Length != 3)
continue;
LocationItems.Add(new LocationItem(position,
objectItems[0],
GetCorrectDoubleValue(objectItems[1]),
GetCorrectDoubleValue(objectItems[2])));
position++;
}
catch (Exception ex)
{
var tmp = ex.ToString();
}
}
return LocationItems;
}
}
示例15: Load
public void Load(Sf2Region region, AssetManager assets)
{
ExclusiveGroup = region.Generators[(int)GeneratorEnum.ExclusiveClass];
ExclusiveGroupTarget = ExclusiveGroup;
iniFilterFc = region.Generators[(int)GeneratorEnum.InitialFilterCutoffFrequency];
filterQ = SynthHelper.DBtoLinear(region.Generators[(int)GeneratorEnum.InitialFilterQ] / 10.0);
initialAttn = -region.Generators[(int)GeneratorEnum.InitialAttenuation] / 10f;
keyOverride = region.Generators[(int)GeneratorEnum.KeyNumber];
velOverride = region.Generators[(int)GeneratorEnum.Velocity];
keynumToModEnvHold = region.Generators[(int)GeneratorEnum.KeyNumberToModulationEnvelopeHold];
keynumToModEnvDecay = region.Generators[(int)GeneratorEnum.KeyNumberToModulationEnvelopeDecay];
keynumToVolEnvHold = region.Generators[(int)GeneratorEnum.KeyNumberToVolumeEnvelopeHold];
keynumToVolEnvDecay = region.Generators[(int)GeneratorEnum.KeyNumberToVolumeEnvelopeDecay];
pan = new PanComponent();
pan.SetValue(region.Generators[(int)GeneratorEnum.Pan] / 500f, PanFormulaEnum.Neg3dBCenter);
modLfoToPitch = region.Generators[(int)GeneratorEnum.ModulationLFOToPitch];
vibLfoToPitch = region.Generators[(int)GeneratorEnum.VibratoLFOToPitch];
modEnvToPitch = region.Generators[(int)GeneratorEnum.ModulationEnvelopeToPitch];
modLfoToFilterFc = region.Generators[(int)GeneratorEnum.ModulationLFOToFilterCutoffFrequency];
modEnvToFilterFc = region.Generators[(int)GeneratorEnum.ModulationEnvelopeToFilterCutoffFrequency];
modLfoToVolume = region.Generators[(int)GeneratorEnum.ModulationLFOToVolume] / 10f;
LoadGen(region, assets);
LoadEnvelopes(region);
LoadLfos(region);
LoadFilter(region);
}