本文整理汇总了C#中Layer类的典型用法代码示例。如果您正苦于以下问题:C# Layer类的具体用法?C# Layer怎么用?C# Layer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Layer类属于命名空间,在下文中一共展示了Layer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CompositionTarget_Rendering
void CompositionTarget_Rendering(object sender, EventArgs e)
{
// Change the opacity of the fromLayer and toLayer
double opacity = -1;
if (animatingLayer == fromLayer)
{
opacity = Math.Max(0, fromLayer.Opacity - .05);
fromLayer.Opacity = opacity;
}
else
{
opacity = Math.Min(1, toLayer.Opacity + .05);
toLayer.Opacity = opacity;
}
// When transition complete, set reset properties and unhook handler
if (opacity == 1 || opacity == 0)
{
fromLayer.Opacity = 0;
fromLayer.Visible = false;
animatingLayer = null;
CompositionTarget.Rendering -= CompositionTarget_Rendering;
// If layer pending animation, start fading
if (pendingLayer != null)
Fade(toLayer, pendingLayer);
pendingLayer = null;
}
}
开发者ID:konglingjie,项目名称:arcgis-samples-silverlight,代码行数:28,代码来源:LayerTransitions.xaml.cs
示例2: Draw
public void Draw(Layer layer)
{
if (activeItem != null)
{
switch (activeItem.NextItem)
{
case TriggerType.MessageClose :
break;
default :
SpriteBatch spriteBatch = GameState.spriteBatch;
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Settings.spriteScale);
foreach (TutorialPair pair in activeItem.PairList)
{
if (pair.Kind == PositionKind.POS_2D && layer == Layer.Layer3)
{
TextWrapping.DrawStringOnScreen(pair.Text, font, Settings.colorMainText, pair.Position.X, pair.Position.Y, spriteBatch, 50f);
}
else if (pair.Kind == PositionKind.POS_3D && layer == Layer.Layer1)
{
BoundingFrustum frustum = new BoundingFrustum(GameState.view * GameState.projection);
ContainmentType containmentType = frustum.Contains(Vector3.Transform(new Vector3(0.0f, 0.0f, 0.0f), pair.World));
if (containmentType != ContainmentType.Disjoint)
{
Vector3 point3D = GameState.game.GraphicsDevice.Viewport.Project(new Vector3(0.0f, 0.0f, 0.0f), GameState.projection, GameState.view, pair.World);
TextWrapping.DrawStringOnScreen(pair.Text, font, Settings.colorMainText, Settings.UnScaleW(point3D.X) + pair.Position.X, Settings.UnScaleH(point3D.Y) + pair.Position.Y, spriteBatch, 50f);
}
}
}
spriteBatch.End();
break;
}
}
}
开发者ID:alenkacz,项目名称:Expanze,代码行数:34,代码来源:Tutorial.cs
示例3: NumberOfNeuronsChanged
void NumberOfNeuronsChanged(Layer layer)
{
dgvTrainingSets.Rows.Clear();
dgvTrainingSets.Columns.Clear();
dgvValidationSets.Rows.Clear();
dgvValidationSets.Columns.Clear();
int c = 0;
for (int i = 1; i <= NN.InputLayer.NumberOfNeurons; i++)
{
dgvTrainingSets.Columns.Add("col" + c++, "Input " + i);
}
for (int i = 1; i <= NN.OutputLayer.NumberOfNeurons; i++)
{
dgvTrainingSets.Columns.Add("col" + c++, "Output " + i);
}
c = 0;
for (int i = 1; i <= NN.InputLayer.NumberOfNeurons; i++)
{
dgvValidationSets.Columns.Add("col" + c++, "Input " + i);
}
for (int i = 1; i <= NN.OutputLayer.NumberOfNeurons; i++)
{
dgvValidationSets.Columns.Add("col" + c++, "Output " + i);
}
}
开发者ID:tlabsim,项目名称:TLABS.ANN,代码行数:26,代码来源:Form1.cs
示例4: Draw
public void Draw( Layer layer, Texture2D atlas, Rectangle offset, Vector2 position )
{
Debug.Assert( atlas != null, "Texture must be valid" );
Debug.Assert( mSpritesToDraw.Count > (int) layer, "There is so such layer" );
mSpritesToDraw[(int)layer].Add( new SpriteRenderInfo( atlas, offset, position ) );
}
开发者ID:smacdo,项目名称:Dungeon-Crawler,代码行数:7,代码来源:Renderer.cs
示例5: LayerTest
public void LayerTest()
{
TestManager.Helpers.CreateTestScene("LayerTest.scene");
IScene scene = EditorManager.Scene;
Assert.IsTrue(scene.Save());
Assert.AreEqual(1,scene.Layers.Count);
// default layer should be active
Assert.IsNotNull(scene.ActiveLayer);
Assert.AreEqual(1,scene.Layers.Count);
Layer layer1 = new Layer("added1");
scene.AddLayer(layer1,false);
Assert.AreEqual(2,scene.Layers.Count);
Layer layer2 = new Layer("added2");
scene.AddLayer(layer2,true);
Assert.AreEqual(3,scene.Layers.Count);
Assert.AreEqual(layer2,scene.ActiveLayer);
Assert.IsTrue(scene.RemoveLayer(layer2));
Assert.IsNotNull(scene.ActiveLayer);
Assert.IsFalse(layer2==scene.ActiveLayer);
TestManager.Helpers.CloseTestProject();
}
开发者ID:shuaiharry,项目名称:projectanarchy,代码行数:27,代码来源:EditorSceneTest.cs
示例6: MoveCaravan
private void MoveCaravan(Layer layer, Caravan caravan)
{
var d = layer.Sections[1].gameObject.transform.position.x * -1;
Vector3 normal;
float y;
layer.Sections[1].GetAt(d, out normal, out y);
caravan.Followers[0].SetPosition(new Vector3(0, layer.Sections[1].gameObject.transform.position.y + y, 0));
caravan.Followers[0].SetRotation(new Vector3(0, 0, (float)(Mathf.Rad2Deg * Math.Atan2(normal.y, normal.x)) - 90));
for (int i = 1; i < caravan.Followers.Count; i++)
{
var del = (layer.Sections[1].gameObject.transform.position.x * -1) - i * 1.5f;
if (del >= 0)
{
d = del;
layer.Sections[1].GetAt(d, out normal, out y);
caravan.Followers[i].SetPosition(new Vector3(0 - i * 1.5f, layer.Sections[1].gameObject.transform.position.y + y, 0));
caravan.Followers[i].SetRotation(new Vector3(0, 0,
(float) (Mathf.Rad2Deg*Math.Atan2(normal.y, normal.x)) - 90));
}
else
{
d = layer.SectionLength + del;
layer.Sections[0].GetAt(d, out normal, out y);
caravan.Followers[i].SetPosition(new Vector3(0 - i * 1.5f, layer.Sections[0].gameObject.transform.position.y + y, 0));
caravan.Followers[i].SetRotation(new Vector3(0, 0,
(float) (Mathf.Rad2Deg*Math.Atan2(normal.y, normal.x)) - 90));
}
}
}
开发者ID:linbozhang,项目名称:bannerSaga,代码行数:30,代码来源:World.cs
示例7: OnLayerChanged
public virtual void OnLayerChanged(Layer newLayer, Layer oldLayer)
{
if (LayerChangedEventHandler != null)
{
LayerChangedEventHandler(this, new LayerChangedEventArgs { NewLayer = newLayer, OldLayer = oldLayer });
}
}
开发者ID:LayeredPlatformer,项目名称:LayeredPlatformerUnity,代码行数:7,代码来源:LayeredController.cs
示例8: Think_CausesEachNeuronInLayerToThink
public void Think_CausesEachNeuronInLayerToThink()
{
Layer layer = new Layer(numberOfNeurons: 2);
// Give each neuron one input and one output.
layer.Neurons[0].Inputs.Add(new Synapse { Weight = 1, Value = 4 });
layer.Neurons[1].Inputs.Add(new Synapse { Weight = 2, Value = 3 });
layer.Neurons[0].Outputs.Add(new Synapse());
layer.Neurons[1].Outputs.Add(new Synapse());
// Reset the biases since we know they are randomized, and we want to disregard them.
layer.Neurons[0].Bias = layer.Neurons[1].Bias = 0;
// Execute the code to test.
layer.Think();
// Validate that each neuron sets the value for its output.
// -4 is the sum of the neurons bias and all its inputs weights times their value.
Assert.AreEqual(
1 / (1 + Math.Pow(Math.E, -4)),
layer.Neurons[0].Outputs[0].Value,
"First neuron output");
// -6 is the sum of the neurons bias and all its inputs weights times their value.
Assert.AreEqual(
1 / (1 + Math.Pow(Math.E, -6)),
layer.Neurons[1].Outputs[0].Value,
"Second neuron output");
}
开发者ID:reneincer,项目名称:ArtificialNeuralNet,代码行数:29,代码来源:LayerTests.cs
示例9: DeleteLayerHistoryMemento
public DeleteLayerHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace, Layer deleteMe)
: base(name, image)
{
this.historyWorkspace = historyWorkspace;
this.index = historyWorkspace.Document.Layers.IndexOf(deleteMe);
this.Data = new DeleteLayerHistoryMementoData(deleteMe);
}
开发者ID:leejungho2,项目名称:xynotecgui,代码行数:7,代码来源:DeleteLayerHistoryMemento.cs
示例10: Highlight
public Highlight()
{
Color = Color.White;
Layer = SpriteManager.AddLayer();
Layer.Name = "GlueView Highlight shapes layer";
mHighlightShapes = new List<Polygon>();
}
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:7,代码来源:Highlight.cs
示例11: Constructor_CreatesCorrectNumberOfNeurons
public void Constructor_CreatesCorrectNumberOfNeurons()
{
Layer layer = new Layer(numberOfNeurons: 5);
Assert.AreEqual(5, layer.Neurons.Count);
Assert.IsTrue(layer.Neurons.All(n => n != null));
}
开发者ID:reneincer,项目名称:ArtificialNeuralNet,代码行数:7,代码来源:LayerTests.cs
示例12: AddBrick
public AddBrick(LayerBrick layer, Layer.LayerItem brickOrGroup)
{
mBrickLayer = layer;
mBrickOrGroup = brickOrGroup;
// after setting the brick or group, call the init brick list function
initBrickList();
}
开发者ID:henrihs,项目名称:bluebrick-id-fork,代码行数:7,代码来源:AddBrick.cs
示例13: StateEditor
public StateEditor(int Row, int Column)
: base(StateID.Editor)
{
//Draw Cursor
m_VisibleCursor = true;
//Set Values
BoardRow = Row;
BoardColumn = Column;
SelectedHeight = 1;
SelectedWidth = 1;
//Nulling Stuffs
m_Data = null;
m_Buttons = null;
m_MenuButtons = null;
m_Sky = null;
m_SkyLayer = null;
m_Arrow = null;
m_Ships = null;
m_Board = null;
m_SideBar = null;
m_SideBarPanel = null;
m_Window = null;
m_Help = null;
}
开发者ID:yggy123,项目名称:closed-sky,代码行数:26,代码来源:StateEditor.cs
示例14: Fade
private void Fade(Layer from, Layer to)
{
// If in process of animating
if (animatingLayer != null)
{
pendingLayer = to;
return;
}
pendingLayer = null;
to.Opacity = 0;
to.Visible = true;
Dispatcher.BeginInvoke(() =>
{
if (progress >= 97)
StartFade(from, to);
else // Wait for layer to load before fading to it
{
EventHandler<ProgressEventArgs> handler = null;
handler = (s, e) =>
{
if (e.Progress >= 97)
{
MyMap.Progress -= handler;
StartFade(from, to);
}
};
MyMap.Progress += handler;
}
});
}
开发者ID:konglingjie,项目名称:arcgis-samples-silverlight,代码行数:31,代码来源:LayerTransitions.xaml.cs
示例15: ScalableElementRuntime
public ScalableElementRuntime(IElement elementSave, Layer layerProvidedByContainer,
NamedObjectSave namedObjectSave, EventHandler<VariableSetArgs> onBeforeVariableSet,
EventHandler<VariableSetArgs> onAfterVariableSet)
: base(elementSave, layerProvidedByContainer, namedObjectSave, onBeforeVariableSet, onAfterVariableSet)
{
}
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:7,代码来源:ScalableElementRuntime.cs
示例16: ReactiveHud
public ReactiveHud()
{
mMarkerLayer = SpriteManager.AddLayer();
#region Create the Sprite Over Marker
mSpriteOverMarker = SpriteManager.AddSprite(
FlatRedBallServices.Load<Texture2D>("Content/smallSquareClear.bmp", AppState.Self.PermanentContentManager),
mMarkerLayer);
mSpriteOverMarker.RelativeZ = -.0001f;
mSpriteOverMarker.Visible = false;
mSpriteOverMarker.Alpha = 100;
#endregion
#region Create the Current Emitter Marker
mCurrentEmitterMarker = SpriteManager.AddSprite(
FlatRedBallServices.Load<Texture2D>("Content/smallSquare.bmp", AppState.Self.PermanentContentManager),
mMarkerLayer);
mCurrentEmitterMarker.Visible = false;
#endregion
mEmissionAreaVisibleRepresentation = new EmissionAreaVisibleRepresentation();
}
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:27,代码来源:ReactiveHud.cs
示例17: LayeredItem
public LayeredItem(Board board, Layer layer, int zm, int x, int y, int z)
: base(board, x, y, z)
{
this.layer = layer;
layer.Items.Add(this);
this.zm = zm;
}
开发者ID:kokose1234,项目名称:HaSuite,代码行数:7,代码来源:LayeredItem.cs
示例18: Background
public Background(GraphicsDeviceManager graphics, Color backgroundColor, Layer[] layerList)
{
_graphics = graphics;
BackgroundColor = backgroundColor;
_layerList = new List<Layer>();
_layerList.AddRange(layerList);
}
开发者ID:steynh,项目名称:GamingMinor,代码行数:7,代码来源:Background.cs
示例19: Execute
public override bool Execute()
{
var layer = new Layer(SelectedLayer);
ActiveImage.InsertLayer(layer, 0);
if (_name != null)
{
layer.Name = _name;
}
else
{
var rx = new Regex(@"(.* copy)(.+)");
var m = rx.Match(layer.Name);
if (m.Groups.Count == 3)
{
int nr = Convert.ToInt32("1") + 1;
layer.Name = m.Groups[1] + " " + nr;
}
}
ActiveDrawable = layer;
SelectedLayer = layer;
return true;
}
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:25,代码来源:DuplicateLayerEvent.cs
示例20: AddLayerToTree
/// <summary>
/// This function adds a given layer to the tree.
/// </summary>
/// <param name="layer">The layer that is being added. </param>
public void AddLayerToTree(Layer layer)
{
MenuItem root = new MenuItem() { Title = "Location" };
root.Items.Add(new MenuItem() { Title = "Time" });
//TreeViewItems.Add(root);
//LayerView.Items.Add(root);
}
开发者ID:travisolbrich,项目名称:AerialMapping,代码行数:11,代码来源:MainWindow.xaml.cs
注:本文中的Layer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论