本文整理汇总了C#中Atom类的典型用法代码示例。如果您正苦于以下问题:C# Atom类的具体用法?C# Atom怎么用?C# Atom使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Atom类属于命名空间,在下文中一共展示了Atom类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:aicl,项目名称:Cayita.Javascript,代码行数:31,代码来源:DemoNavlist.cs
示例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);
}
开发者ID:aicl,项目名称:Cayita.Javascript,代码行数:26,代码来源:DemoModals.cs
示例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);
}
开发者ID:mr-sandy,项目名称:kola,代码行数:25,代码来源:WhenInheritingPropertyValuesFromAWidgetGrandparent.cs
示例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);
}
开发者ID:aicl,项目名称:Cayita.Javascript,代码行数:33,代码来源:DemoNavbar.cs
示例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);
}
开发者ID:sams28,项目名称:Dock-Hap,代码行数:32,代码来源:DisplayUnityObj.cs
示例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);
}
开发者ID:sylvainhalle,项目名称:BeepBeepCSharp,代码行数:46,代码来源:OperatorMinus.cs
示例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;
}
开发者ID:Fux90,项目名称:GodsWill_ASCIIRPG,代码行数:35,代码来源:SpotPerception.cs
示例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();
}
开发者ID:kbochenina,项目名称:Kraken,代码行数:28,代码来源:SempAdapter.cs
示例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;
}
开发者ID:wallymathieu,项目名称:Prolog.NET,代码行数:26,代码来源:Term.cs
示例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);
}
开发者ID:aicl,项目名称:Cayita.Javascript,代码行数:35,代码来源:DemoFileUpload.cs
示例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;
}
开发者ID:fielddaylab,项目名称:atomtouch,代码行数:25,代码来源:PeriodicBoundaryCondition.cs
示例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);
}
开发者ID:kumaryu,项目名称:peercaststation,代码行数:7,代码来源:StreamExtension.cs
示例13: Visit
public void Visit(Atom atom)
{
var specification = this.componentLibrary.Lookup(atom.Name);
foreach (var propertySpecification in specification.Properties)
{
atom.FindOrCreateProperty(propertySpecification);
}
}
开发者ID:mr-sandy,项目名称:kola,代码行数:8,代码来源:ComponentRefreshingVisitor.cs
示例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;
});
}
开发者ID:aicl,项目名称:Cayita.Javascript,代码行数:8,代码来源:DemoFileUpload.cs
示例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);
}
开发者ID:ma4u,项目名称:pd-macambira,代码行数:8,代码来源:Counter.cs
示例16: SetUp
public void SetUp()
{
var atomSpecification = new AtomSpecification("atom 1");
atomSpecification.AddProperty(new PropertySpecification("property 1 name", "property 1 type", string.Empty));
atomSpecification.AddProperty(new PropertySpecification("property 2 name", "property 2 type", "property 2 default"));
this.atom = atomSpecification.Create();
}
开发者ID:mr-sandy,项目名称:kola,代码行数:8,代码来源:WhenCreatingAnAtomFromItsSpecification.cs
示例17: SetUp
public void SetUp()
{
var templatePath = new[] { "test", "path" };
this.template = new Template(templatePath);
var newComponent = new Atom("component1", null);
this.template.Insert(0, newComponent);
}
开发者ID:mr-sandy,项目名称:kola,代码行数:8,代码来源:WhenAddingTheFirstComponentToATemplate.cs
示例18: Build
public AtomInstance Build(Atom atom, IEnumerable<int> path, IBuildData buildData)
{
return new AtomInstance(
path,
this.renderingInstructions,
atom.Name,
atom.Properties.Select(p => p.Build(buildData)).ToList());
}
开发者ID:mr-sandy,项目名称:kola,代码行数:8,代码来源:InstanceBuildingComponentVisitor.cs
示例19: ToRules
public static RuleData ToRules(List<Token> input)
{
var output = new RuleData();
var currentTerm = new Term();
output.Terms.Add(currentTerm);
currentTerm.Id = output.Terms.Count;
while (input.Count > 0)
{
var currentAtom = new Atom();
currentTerm.Atoms.Add(currentAtom);
//negativeness
if (input[0].Type == TokenType.Negate)
{
currentAtom.Truthfulness = false;
TokenPop(input);
}
//name
var nameToken = TokenPop(input);
Expect(nameToken, TokenType.String);
currentAtom.Name = nameToken.Name;
//arguments
Expect(TokenPop(input), TokenType.ParenBegin);
GetArguments(input, currentAtom.Arguments);
var orOrPeriodOrQuestionMark = TokenPop(input);
switch (orOrPeriodOrQuestionMark.Type)
{
case TokenType.Or:
continue;
case TokenType.Period:
if (input.Count > 0)
{
currentTerm = new Term();
output.Terms.Add(currentTerm);
currentTerm.Id = output.Terms.Count;
}
continue;
case TokenType.QuestionMark:
output.Terms.Remove(currentTerm);
output.Goal = currentTerm.Atoms[0];
if (input.Count > 0)
{
currentTerm = new Term();
output.Terms.Add(currentTerm);
currentTerm.Id = output.Terms.Count;
}
continue;
}
throw new Exception("Not the right input: " + orOrPeriodOrQuestionMark.Name);
}
return output;
}
开发者ID:connorcarpenter,项目名称:ResolutionSolver,代码行数:57,代码来源:Parser.cs
示例20: Interaction
public override bool Interaction(Atom interactor)
{
if (interactor.GetType() == typeof(Pg))
{
interactor.NotifyListeners(String.Format("It's a {0}", this.Name));
}
return false;
}
开发者ID:Fux90,项目名称:GodsWill_ASCIIRPG,代码行数:9,代码来源:SceneryItem.cs
注:本文中的Atom类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论