本文整理汇总了C#中Environment类的典型用法代码示例。如果您正苦于以下问题:C# Environment类的具体用法?C# Environment怎么用?C# Environment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Environment类属于命名空间,在下文中一共展示了Environment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StoreGet
public StoreGet(Environment environment, Action<Event> callback)
: base(environment)
{
CallbackList.Add(callback);
Time = environment.Now;
Process = environment.ActiveProcess;
}
示例2: Cond
public static SExp Cond(SExp[] vals, Environment env)
{
SExp res = new Undefined();
foreach (SExp exp in vals)
{
if (!(exp is Cell))
{
string msg = "cond: malformed clauses.";
throw new TypeNotMatchException(msg);
}
SExp test = (exp as Cell).Car;
if (!((exp as Cell).Cdr is Cell))
{
string msg = "cond: malformed clauses.";
throw new TypeNotMatchException(msg);
}
SExp[] body = ((exp as Cell).Cdr as Cell).ToArray();
if (Utilities.CanRegardAsTrue(Utilities.Eval(test, env)))
{
res = Utilities.Eval(body, env);
break;
}
}
return res;
}
示例3: Environment_Constructor_Sets_Properties_Correctly
public void Environment_Constructor_Sets_Properties_Correctly()
{
var environment = new Environment("en-gb")
{
CharacterSet = "iso-8550-1",
FlashVersion = "11.0.1b",
ScreenColorDepth = 32,
IpAddress = "127.0.0.1",
JavaEnabled = true,
ScreenHeight = 1050,
ScreenWidth = 1920,
ViewportHeight = 768,
ViewportWidth = 1024
};
Assert.AreEqual("iso-8550-1", environment.CharacterSet);
Assert.AreEqual("en-gb", environment.LanguageCode);
Assert.AreEqual("11.0.1b", environment.FlashVersion);
Assert.AreEqual(32u, environment.ScreenColorDepth);
Assert.AreEqual("127.0.0.1", environment.IpAddress);
Assert.AreEqual(true, environment.JavaEnabled);
Assert.AreEqual(1050u, environment.ScreenHeight);
Assert.AreEqual(1920u, environment.ScreenWidth);
Assert.AreEqual(768u, environment.ViewportHeight);
Assert.AreEqual(1024u, environment.ViewportWidth);
}
示例4: PanningBackground
public PanningBackground()
{
m_parallaxEnvironments = new LinkedList<ParallaxEnvironment>();
m_random = new Random(DateTime.Now.Millisecond);
float t_houseDistance = Game.getInstance().getResolution().X / 10;
m_background = Game.getInstance().Content.Load<Texture2D>("Images//Background//starry_sky_01");
for (int i = 0; i < 50; i++)
{
m_parallaxEnvironments.AddLast(new ParallaxEnvironment(
new Vector2(t_houseDistance * i - Game.getInstance().m_camera.getRectangle().Width, -300),
"Images//Background//Parallax//bg_house_0" + randomNumber(1, 7).ToString(),
0.950f
));
m_parallaxEnvironments.Last().setParrScroll(randomNumber(50, 600));
}
for (int i = 0; i < 25; i++)
{
m_parallaxEnvironments.AddLast(new ParallaxEnvironment(
new Vector2(t_houseDistance * i - Game.getInstance().m_camera.getRectangle().Width, randomNumber(-300, 200)),
"Images//Background//Parallax//clouds_0" + randomNumber(1, 4).ToString(),
0.950f
));
m_parallaxEnvironments.Last().setParrScroll(randomNumber(50, 600));
}
m_logo = new Environment(new Vector2(-400, -250), "Images//GUI//logotext", 0.800f);
}
示例5: DeleteInfo
void ICanModifyContext.PopulateContext(Environment env, string ns)
{
AST ast;
for (int i = 0; i < elems.Count; i++) {
ast = (AST) elems [i];
if (ast is FunctionDeclaration) {
string name = ((FunctionDeclaration) ast).func_obj.name;
AST binding = (AST) env.Get (ns, Symbol.CreateSymbol (name));
if (binding == null)
SemanticAnalyser.Ocurrences.Enter (ns, Symbol.CreateSymbol (name), new DeleteInfo (i, this));
else {
DeleteInfo delete_info = (DeleteInfo) SemanticAnalyser.Ocurrences.Get (ns, Symbol.CreateSymbol (name));
if (delete_info != null) {
delete_info.Block.elems.RemoveAt (delete_info.Index);
SemanticAnalyser.Ocurrences.Remove (ns, Symbol.CreateSymbol (name));
if (delete_info.Block == this)
if (delete_info.Index < i)
i--;
SemanticAnalyser.Ocurrences.Enter (ns, Symbol.CreateSymbol (name), new DeleteInfo (i, this));
}
}
}
if (ast is ICanModifyContext)
((ICanModifyContext) ast).PopulateContext (env, ns);
}
}
示例6: BasicLoopWord
public BasicLoopWord(string definingWordName, Environment env)
: base(definingWordName, env)
{
CycleWord = new ControlFlowWord("cycle", env);
PrimitiveExecuteAction = executeLoop;
}
示例7: EvaluateTimeBase
/// <summary>
/// Initializes a new instance of the EvaluateTimeBase class.
/// </summary>
/// <param name="expr">The expression to evaluate.</param>
/// <param name="count">The number of times to evaluate.</param>
/// <param name="env">The evaluation environment</param>
/// <param name="caller">The caller. Return to this when done.</param>
protected EvaluateTimeBase(SchemeObject expr, int count, Environment env, Evaluator caller)
: base(InitialStep, expr, env, caller)
{
this.counter = count;
this.startMem = GC.GetTotalMemory(true);
this.stopwatch = Stopwatch.StartNew();
}
示例8: Instance
// AudioContexts are per process and not per thread
public static Environment Instance()
{
if (env == null)
env = new Environment();
return env;
}
示例9: copy
//Constructor that initializes variables with default values
public Environment copy()
{
Environment newenv = new Environment();
newenv.seed=seed;
newenv.AOIRectangle = new Rectangle(AOIRectangle.X,AOIRectangle.Y,AOIRectangle.Width,AOIRectangle.Height);
newenv.group_orientation = group_orientation;
newenv.goal_point = new Point2D(goal_point);
newenv.start_point = new Point2D(start_point);
newenv.robot_heading = robot_heading;
newenv.robot_spacing = robot_spacing;
newenv.maxDistance=maxDistance;
newenv.name=name;
newenv.view_scale=view_scale;
newenv.view_x=view_x;
newenv.view_y=view_y;
foreach (Wall w in walls) {
newenv.walls.Add(new Wall(w));
}
foreach (Prey p in preys) {
newenv.preys.Add(new Prey(p));
}
foreach (Point p in POIPosition) {
newenv.POIPosition.Add(new Point(p.X,p.Y));
}
newenv.rng = new SharpNeatLib.Maths.FastRandom(seed);
return newenv;
}
示例10: GrabComponent
public GrabComponent(Entity parent, Environment environment, float baseDamage, float maxDamage)
: base(parent, "GrabComponent")
{
this.environment = environment;
this.baseDamage = baseDamage;
this.maxDamage = maxDamage;
}
示例11: eval
public override Node eval(Node t, Environment env)
{
Node clauseList = t.getCdr();
Node clause = clauseList.getCar();
while(clause != Nil.getInstance())
{
Node predicate = clause.getCar().eval(env);
if(predicate == BoolLit.getInstance(true) || predicate.getName() == "else")
{
Node expressionList = clause.getCdr();
//evaluate all expressions and return the result of the last evaluation
Node lastEval = expressionList.getCar().eval(env);
//If there are more expressions to evaluate
while(expressionList.getCdr() != Nil.getInstance())
{
expressionList = expressionList.getCdr();
lastEval = expressionList.getCar().eval(env);
}
return lastEval;
}
clauseList = clauseList.getCdr();
clause = clauseList.getCar();
}
//Does not yet handle else's
return Nil.getInstance();
}
示例12: play
public void play(Environment e, UsefulMethods odd, Player player)
{
Random rand = new Random();
int randNum = rand.Next(0, 0); // update for number of missions
if (randNum == 0)
environment_1(e, odd, player);
}
示例13: SamplingRecordProvider
internal SamplingRecordProvider(Environment environment, IEnvironmentService service,
IRecordable recordable, int id, bool recordPeriodEnabled, TimeSpan recordPeriod)
: base(environment, service, recordable, id)
{
this.recordPeriodEnabled = recordPeriodEnabled;
this.recordPeriod = recordPeriod;
}
示例14: CreateScene
/// <summary>
/// This method create the initial scene
/// </summary>
protected override void CreateScene()
{
#region Basics
physics = new Physics();
robot = new Robot(mSceneMgr);
robot.setPosition(new Vector3(000, 0, 300));
environment = new Environment(mSceneMgr, mWindow);
playerModel = new PlayerModel(mSceneMgr);
playerModel.setPosition(new Vector3(0, -80, 50));
playerModel.hRotate(new Vector3(600, 0, 0));
#endregion
#region Camera
cameraNode = mSceneMgr.CreateSceneNode();
cameraNode.AttachObject(mCamera);
playerModel.AddChild(cameraNode);
inputsManager.PlayerModel = playerModel;
#endregion
#region Part 9
PlayerStats playerStats = new PlayerStats();
gameHMD = new GameInterface(mSceneMgr, mWindow, playerStats);
#endregion
robots = new List<Robot>();
robots.Add(robot);
robotsToRemove = new List<Robot>();
bombs = new List<Bomb>();
bombsToRemove = new List<Bomb>();
physics.StartSimTimer();
}
示例15: DeviceProvider
private DeviceProvider(Environment environment, IEnvironmentService service,
Guid id, string name, string description)
: base(id, name, description)
{
this.environment = environment;
this.service = service;
}