本文整理汇总了C#中Atom类的典型用法代码示例。如果您正苦于以下问题:C# Atom类的具体用法?C# Atom怎么用?C# Atom使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Atom类属于命名空间,在下文中一共展示了Atom类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public static void Execute(Atom parent)
{
var nb =new NavList ();
nb.Add ("Tables");
nb.Add ("Forms");
nb.Add ("Modals");
nb.Add ("Panels");
nb.AddDivider ();
nb.Add ("Exit");
var log = new Div ();
var code = new Div ();
new Div (d=>{
d.ClassName="bs-docs-example";
d.JQuery.Append(nb).Append(log).Append("C# code".Header(4)).Append(code);
parent.Append(d);
});
nb.Selected += (e) => {
var i = e.CurrentTarget.As<NavItem> ();
log.Text= "{0} Clicked".Fmt(i.Text);
};
var rq =jQuery.GetData<string> ("code/demonavlist.html");
rq.Done (s=> code.Text=s);
}
示例2: Execute
public static void Execute (Atom parent){
var nb =new NavList ();
nb.Add ("Simple Bootbox Dialog", handler: e=> Bootbox.Dialog("cayita is awesome"));
nb.Add ("Custom Bootbox.Dialog I", handler: CustomDialog_1);
nb.Add ("Custom Bootbox.Dialog 2", handler: CustomDialog_2);
nb.Add ("Custom Bootbox.Dialog 3", handler: CustomDialog_3);
nb.AddDivider ();
nb.Add ("Alert", handler: e=> Bootbox.Alert("Alert!",()=> "Alert callback...".LogInfo()));
nb.Add ("Confirm", handler: e=> Bootbox.Confirm("Confirm...",(c)=> ("Confirm callback "+c).LogInfo()));
nb.Add ("Prompt", handler: e=> Bootbox.Prompt("Pormpt...",(s)=> ("Prompt callback "+s).LogInfo()));
var code = new Div ();
new Div (d=>{
d.ClassName="bs-docs-example";
d.JQuery.Append(nb).Append("C# code".Header(4)).Append(code);
parent.Append(d);
});
var rq =jQuery.GetData<string> ("code/demomodals.html");
rq.Done (s=> code.InnerHTML=s);
}
示例3: SetUp
public void SetUp()
{
var atom = new Atom(
"atom",
new[] { new Property("property-name", "property-type", new InheritedPropertyValue("property-alias")) });
var containerSpecification = new ContainerSpecification("container");
var container = containerSpecification.Create();
container.Insert(0, atom);
var widgetSpecification = new WidgetSpecification(
"widget",
new[] { new PropertySpecification("property-alias", "property-type", string.Empty) },
new[] { container });
var buildContext = new BuildData(Enumerable.Empty<IContextItem>());
var widget = widgetSpecification.Create();
widget.FindOrCreateProperty(new PropertySpecification("property-alias", "property-type", string.Empty));
widget.Properties.Single().Value = new FixedPropertyValue("property-value");
var builder = new Builder(RenderingInstructions.BuildForPreview(), w => widgetSpecification, null);
this.instance = widget.Build(builder, new[] { 0 }, buildContext);
}
示例4: Execute
public static void Execute(Atom parent)
{
var nb =new NavBar ();
nb.BrandText="App Title";
nb.Add ("Home");
nb.Add ("License");
nb.Add ("Contact");
var dd = new DropdownMenu ();
dd.Text = "Config";
dd.Nav.Add ("Users");
dd.Nav.Add ("Groups");
nb.Add (dd);
var log = new Div ();
var code = new Div ();
new Div (d=>{
d.ClassName="bs-docs-example";
d.JQuery.Append(nb).Append(log).Append("C# code".Header(4)).Append(code);
parent.Append(d);
});
nb.Selected += (e) => {
var i = e.CurrentTarget.As<NavItem> ();
log.Text= "{0} Clicked".Fmt(i.Text);
};
var rq =jQuery.GetData<string> ("code/demonavbar.html");
rq.Done (s=> code.Text=s);
}
示例5: displayAtom
public void displayAtom(Atom a,float scale)
{
a.Gameobject[frame] = (GameObject)Instantiate (Resources.Load("Prefabs/Atom") as GameObject, a.Location[frame], Quaternion.identity);
a.Gameobject[frame].name = a.AtomFullName;
a.Gameobject[frame].transform.localScale = new Vector3(scale,scale,scale);
/* cut sphere
Vector3[] vertices =a.Gameobject.GetComponent<MeshFilter>().mesh.vertices;
List<int> indices = new List<int>(a.Gameobject.GetComponent<MeshFilter>().mesh.triangles);
int count = indices.Count / 3;
Vector3 norm = a.Gameobject.transform.position.normalized;
float d = 0.1f;
for (int j = count-1; j >= 0; j--)
{
Vector3 V1 = vertices[indices[j*3 + 0]];
Vector3 V2 = vertices[indices[j*3 + 1]];
Vector3 V3 = vertices[indices[j*3 + 2]];
float t1 = V1.x*norm.x+V1.y*norm.y+V1.z*norm.z;
float t2 = V2.x*norm.x+V2.y*norm.y+V2.z*norm.z;
float t3 = V3.x*norm.x+V3.y*norm.y+V3.z*norm.z;
if(norm != Vector3.zero){
if (t1 < d && t2 < d && t3 < d)
indices.RemoveRange(j*3, 3);
}
}
a.Gameobject.GetComponent<MeshFilter>().mesh.triangles = indices.ToArray();
*/
a.Gameobject[frame].GetComponent<Renderer>().material = setMaterialAtm(a,color);
}
示例6: evaluate
/**
* Evaluates a CTL-FO+ formula by replacing an atom by another in it. You
* can actually replace an atom by a whole formula.
* <p>
* In the case of a Minus operator, evaluates the subtraction if both sides
* are numerical. Otherwise, the operation cannot be resolved to a constant
* and is returned partially evaluated.
* <p>
* The values in the left- and right-hand side are first evaluated as
* numbers (floats), if they can both be parsed as numbers. Otherwise, they
* are compared using alphabetical order.
*
* @param variable
* The atom to look for.
* @param value
* The value to replace it with.
* @return The evaluated formula
*/
public override Operator evaluate(Atom variable, Operator val)
{
Operator leftPart = m_left.evaluate(variable, val);
Operator rightPart = m_right.evaluate(variable, val);
float num_left = 0.0f, num_right = 0.0f;
if (leftPart.GetType() == (new Constant()).GetType() &&
rightPart.GetType() == (new Constant()).GetType())
{
try
{
num_left = float.Parse(leftPart.ToString());
num_right = float.Parse(rightPart.ToString());
return new Constant(((float)(num_left - num_right)).ToString());
}
catch (System.FormatException fe)
{
System.Diagnostics.Debug.Print (fe.ToString());
}
// We are here: LHS and RHS are not both numbers
// (Do nothing)
}
return new OperatorMinus(leftPart, rightPart);
}
示例7: SensingProcess
protected override bool SensingProcess(Character sensor, Atom sensed, int CD)
{
var res = Dice.Throws(20)
+ sensor.Stats[StatsType.Mental].ModifierOfStat()
+ sensor.TempModifiers.GetBonus<int>(TemporaryModifier.ModFor.SpotPerception,
(a, b) => a + b); ;
var isSensed = res >= CD;
var sensorType = sensor.GetType();
var pgType = typeof(Pg);
var sensedType = sensed.GetType();
if (isSensed)
{
if (typeof(HiddenAtom).IsAssignableFrom(sensedType))
{
var _sensed = (HiddenAtom)sensed;
if (_sensed.Hidden)
{
_sensed.NotifyIndividuation();
}
}
else
{
if (sensorType == pgType || sensorType.IsSubclassOf(pgType))
{
var msg = "Noises in the area...";
sensor.NotifyListeners(msg);
}
}
}
return isSensed;
}
示例8: GetProperMoleculeDescription
protected override string GetProperMoleculeDescription(Atom[] atoms)
{
string content = "";
int atomsInLine = 0;
foreach (var atom in atoms)
{
content += String.Format("{0,-3}", atom.Element);
atomsInLine = (atomsInLine + 1) % 26;
if (atomsInLine == 0)
content += Environment.NewLine;
}
bool even = false;
foreach (var atom in atoms)
{
if (!even)
content += Environment.NewLine;
content += String.Format(CultureInfo.InvariantCulture, "{0,10:F5}{1,10:F5}{2,10:F5}",
atom.X, atom.Y, atom.Z);
even = !even;
}
return content.Trim();
}
示例9: Rule
public static void Rule(Term lhs, Atom atom, OptionalTermBody optionalTermBody)
{
CodeCompoundTerm codeCompoundTerm;
if (optionalTermBody.CodeTerms == null)
{
CodeFunctor codeFunctor = new CodeFunctor(atom.Text);
codeCompoundTerm = new CodeCompoundTerm(codeFunctor);
}
else
{
CodeFunctor codeFunctor = new CodeFunctor(atom.Text, optionalTermBody.CodeTerms.Count);
if (codeFunctor.Arity == 0)
{
codeCompoundTerm = new CodeCompoundTerm(codeFunctor);
}
else
{
codeCompoundTerm = new CodeCompoundTerm(codeFunctor, optionalTermBody.CodeTerms);
}
}
lhs.CodeCompoundTerm = codeCompoundTerm;
}
示例10: Execute
public static void Execute(Atom parent)
{
var fp = new Div ("bs-docs-example");
var ff = new FileField (fp);
var ufb = CreateUploadButton (fp);
var logf = new Div (fp);
var imp = new Div ("bs-docs-example");
var imf = new ImgField (imp);
var imb = CreateUploadButton (imp);
var logim = new Div (imp);
parent.JQuery
.Append ("File Upload".Header(3))
.Append (fp)
.Append ("Image Upload".Header(3))
.Append (imp);
var rq =jQuery.GetData<string> ("code/demofileupload.html");
rq.Done (s=> {
var code=new Div();
code.InnerHTML= s;
parent.JQuery.Append ("C# code".Header(3)).Append(code);
});
ff.Changed+= (e) => ShowFileInfo(ufb, logf,ff.Input);
imf.Changed+= (e) => ShowFileInfo(imb, logim, imf.Input);
ufb.Clicked+= (e) => SendFile(ufb, ff.Input);
imb.Clicked+= (e) => SendFile(imb, imf.Input);
}
示例11: deltaPosition
public override Vector3 deltaPosition(Atom firstAtom, Atom secondAtom)
{
Vector3 boxDimension = new Vector3 (CreateEnvironment.myEnvironment.width-2.0f * CreateEnvironment.myEnvironment.errorBuffer, CreateEnvironment.myEnvironment.height-2.0f * CreateEnvironment.myEnvironment.errorBuffer , CreateEnvironment.myEnvironment.depth-2.0f * CreateEnvironment.myEnvironment.errorBuffer);
Vector3 deltaR = firstAtom.position - secondAtom.position;
if (Mathf.Abs(deltaR.x) > boxDimension.x / 2.0f)
{
float sign = Mathf.Sign(deltaR.x);
deltaR.x = deltaR.x - sign * boxDimension.x;
}
if (Mathf.Abs(deltaR.y) > boxDimension.y / 2.0f)
{
float sign = Mathf.Sign(deltaR.y);
deltaR.y = deltaR.y- sign * boxDimension.y;
}
if (Mathf.Abs(deltaR.z) > boxDimension.z / 2.0f)
{
float sign = Mathf.Sign(deltaR.z);
deltaR.z = deltaR.z- sign * boxDimension.z;
}
return deltaR;
}
示例12: WriteAsync
static public async Task WriteAsync(this Stream stream, Atom atom, CancellationToken cancel_token)
{
var bufstream = new MemoryStream();
bufstream.Write(atom);
var buf = bufstream.ToArray();
await stream.WriteAsync(buf, 0, buf.Length, cancel_token);
}
示例13: Visit
public void Visit(Atom atom)
{
var specification = this.componentLibrary.Lookup(atom.Name);
foreach (var propertySpecification in specification.Properties)
{
atom.FindOrCreateProperty(propertySpecification);
}
}
示例14: CreateUploadButton
static ButtonIcon CreateUploadButton(Atom parent){
return new ButtonIcon (parent, imb=>{
imb.IconClass="icon-upload";
imb.Text = "Upload";
imb.AddClass ("btn-info");
imb.Disabled=true;
});
}
示例15: Bound
protected void Bound(Atom[] args)
{
float f1 = (float)args[0];
float f2 = (float)args[1];
this.i_down = (int)((f1<f2)?f1:f2);
this.i_up = (int)((f1>f2)?f1:f2);
}