本文整理汇总了C#中Puzzle类的典型用法代码示例。如果您正苦于以下问题:C# Puzzle类的具体用法?C# Puzzle怎么用?C# Puzzle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Puzzle类属于命名空间,在下文中一共展示了Puzzle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnExecuting
public void OnExecuting(object sender, Puzzle.SideFX.Framework.Execution.ExecutionCancelEventArgs e)
{
IEngine engine = sender as IEngine;
DisplayObjectsCommand displayObjectsCommand = DisplayObjectsCommand.Evaluate(engine, e.Command);
if (displayObjectsCommand == null)
return;
IObjectService objectService = engine.GetService<IObjectService>();
IDisplayService displayService = engine.GetService<IDisplayService>();
IDatabaseService databaseService = engine.GetService<IDatabaseService>();
databaseService.EnsureTransaction();
Type type = objectService.GetTypeByName(displayObjectsCommand.ClassName);
IList objects = null;
if (!string.IsNullOrEmpty(displayObjectsCommand.Where))
objects = objectService.GetObjects(type, displayObjectsCommand.Where);
else
objects = objectService.GetObjects(type, displayObjectsCommand.Match);
if (objects != null)
{
foreach (object obj in objects)
{
if (displayObjectsCommand.List)
displayService.List(obj);
else
displayService.Display(obj);
}
}
}
示例2: HandleCall
public object HandleCall(Puzzle.NAspect.Framework.MethodInvocation call)
{
Console.WriteLine("Enter");
object res= call.Proceed();
Console.WriteLine("Exit");
return res;
}
示例3: OnPuzzleCreate
public override void OnPuzzleCreate(Puzzle puzzle)
{
var place = puzzle.GetPlace("PuzzlePlace");
place.SpawnSingleMob("Mob1", 50002, 3); // Red Fox
place.SpawnSingleMob("Mob2", 50003, 2); // Gray Fox
}
示例4: Construct
public void Construct(List<Puzzle> puzzles)
{
puzzles.Sort();
foreach (Puzzle puzzle in puzzles)
{
Puzzle automatedPuzzle = new Puzzle();
automatedPuzzle.Location = new System.Drawing.Point(puzzle.CoordinateX + form.Width - _image.Width - distanseBetweenControls, puzzle.CoordinateY + distanseBetweenControls);
automatedPuzzle.Size = new System.Drawing.Size(puzzle.Width, puzzle.Height);
automatedPuzzle.Width = puzzle.Width;
automatedPuzzle.Height = puzzle.Height;
automatedPuzzle.Image = puzzle.Image;
automatedPuzzle.BorderStyle = BorderStyle.Fixed3D;
automatedPuzzle.Click += new EventHandler(automatedPuzzle_Click);
if (puzzle.topPuzzle != null && puzzle.topPuzzle.Image != null)
{
automatedPuzzle.topPuzzle= SetPuzzle(automatedPuzzle.topPuzzle);
automatedPuzzle.topPuzzle.Image = puzzle.topPuzzle.Image;
smallPuzzles.SetTopPuzzleLocation(automatedPuzzle);
}
if (puzzle.rightPuzzle != null && puzzle.rightPuzzle.Image != null)
{
automatedPuzzle.rightPuzzle = SetPuzzle(automatedPuzzle.rightPuzzle);
automatedPuzzle.rightPuzzle.Image = puzzle.rightPuzzle.Image;
smallPuzzles.SetRightPuzzleLocation(automatedPuzzle);
}
form.Controls.Add(automatedPuzzle);
automatedConstructPuzzlesList.Add(automatedPuzzle);
_image.SendToBack();
}
}
示例5: PuzzleAnalysis
public PuzzleAnalysis(Puzzle start)
{
Start = start;
Static = StaticAnalysis.Generate(start);
Static.DeadMap = DeadMapAnalysis.FindDeadMap(Static);
}
示例6: SetLeftPuzzleLocation
public void SetLeftPuzzleLocation(Puzzle puzzle)
{
for (int j = 0; j < puzzle.leftPuzzle.Count; j++)
{
Point point = new Point();
if (puzzle.ImageDegree == 0)
{
point = new Point(puzzle.Location.X,
puzzle.Location.Y + puzzle.leftPuzzle[j].CoordinateY);
}
else if (puzzle.ImageDegree == 90)
{
point = new Point(puzzle.Location.X + puzzle.Size.Width - puzzle.leftPuzzle[j].CoordinateY - 10,
puzzle.Location.Y);
}
else if (puzzle.ImageDegree == 180)
{
point = new Point(puzzle.Location.X + puzzle.Size.Width - 10,
puzzle.Location.Y + puzzle.Size.Height - puzzle.leftPuzzle[j].CoordinateY-10);
}
else
{
point = new Point(puzzle.Location.X+puzzle.leftPuzzle[j].CoordinateY,
puzzle.Location.Y + puzzle.Size.Height - 10);
}
puzzle.leftPuzzle[j].Location = point;
}
}
示例7: OnMonsterDead
public override void OnMonsterDead(Puzzle puzzle, MonsterGroup group)
{
if (group.Remaining != 0)
return;
puzzle.GetPlace("Place").OpenAllDoors();
}
示例8: StartPuzzle
public UnityAction StartPuzzle(Puzzle puzzle)
{
Puzzle puzzleRefCopy = puzzle;
return () =>
{
if(currentPuzzle != null)
currentPuzzle.SaveProgress();
el.ClearExampleList();
gc.SetPuzzle(puzzleRefCopy);
//puzzleRefCopy.LoadProgress();
List<Board> testedExamples = puzzleRefCopy.testedExamples;
foreach(Board board in testedExamples) {
el.AddExample(board);
}
if(!el.ContainsExample(puzzleRefCopy.example1))
el.AddExample(puzzleRefCopy.example1);
if(!el.ContainsExample(puzzleRefCopy.example2))
el.AddExample(puzzleRefCopy.example2);
ssc.SwapTo(el.GetComponent<Animator>());
currentPuzzle = puzzleRefCopy;
};
}
示例9: Awake
void Awake()
{
instance = this;
List<Game> GamePrefabs = new List<Game>(Resources.LoadAll<Game>("Prefabs/Games/Puzzle"));
GamePrefabs.RemoveAll(game => game.type != Game.GameType.Puzzle);
GamePrefabs.Sort(delegate(Game a, Game b)
{
return a.order.CompareTo(b.order);
});
puzzles = new List<Puzzle>();
foreach (Game game in GamePrefabs)
{
Puzzle puzzle = new Puzzle();
puzzle.name = game.name;
puzzle.stars = PlayerPrefs.GetInt(puzzle.name + "stars", 0);
if (puzzles.Count == 0) //first level is always unlocked
puzzle.unlocked = true;
else
puzzle.unlocked = PlayerPrefs.GetInt(puzzle.name + "unlocked", 0) != 0;
puzzle.prefab = game;
puzzles.Add(puzzle);
}
}
示例10: CreateRelationship
public void CreateRelationship(CreatePropertyCommand createPropertyCommand, object sender, Puzzle.SideFX.Framework.Execution.ExecutionCancelEventArgs e)
{
IEngine engine = sender as IEngine;
ISchemaService schemaService = engine.GetService<ISchemaService>();
IDatabaseService databaseService = engine.GetService<IDatabaseService>();
string className = createPropertyCommand.ClassName;
string propertyName = createPropertyCommand.Name;
string propertyType = createPropertyCommand.Type.ToString();
string columnName = createPropertyCommand.ColumnName;
DbType columnType = DbType.Int32; //TODO: Get the column of the identity property
string tableName = schemaService.GetTableForClass(className);
switch (createPropertyCommand.Multiplicity)
{
case Multiplicity.OneToMany:
case Multiplicity.OneToOne:
//Add a property to the class
schemaService.CreateProperty(className, propertyName, propertyType);
//Set the nullability of the property
schemaService.SetPropertyMetaData(className, propertyName, PropertyMetaData.Nullable, createPropertyCommand.Nullable);
//Add a column to the table
schemaService.CreateColumn(tableName, columnName, columnType);
//Set the nullability of the column
schemaService.SetColumnMetaData(tableName, columnName, ColumnMetaData.Nullable, createPropertyCommand.Nullable);
//Map the property to the column in the schema
schemaService.MapPropertyToColumn(className, propertyName, tableName, columnName);
break;
case Multiplicity.ManyToMany:
//Add a property to the class
schemaService.CreateListProperty(className, propertyName, propertyType);
//Add a many-many table
//schemaService.CreateTable(tableName, columnName, columnType);
break;
case Multiplicity.ManyToOne:
//Add a property to the class
schemaService.CreateListProperty(className, propertyName, propertyType);
//Add a column to the table
//schemaService.CreateColumn(tableName, columnName, columnType);
break;
}
}
示例11: HandleCall
public object HandleCall(Puzzle.NAspect.Framework.MethodInvocation call)
{
Console.WriteLine("entering {0}", call.ValueSignature);
object res = call.Proceed();
Console.WriteLine("exiting {0} and returning '{1}'", call.ValueSignature,res);
return res;
}
示例12: test
public static void test( Puzzle initial, String proconFormat )
{
String[] lines = proconFormat.Split( new string[]{Environment.NewLine}, StringSplitOptions.None);
int choiceCount = int.Parse( lines[0] );
for( int i = 0; i < choiceCount; i++ )
{
String pos = lines[1 + i * 3];
int moveCount = int.Parse(lines[2 + i * 3]);
int blankColumn = int.Parse(pos[0].ToString(), System.Globalization.NumberStyles.AllowHexSpecifier) + 1;
int blankRow = int.Parse(pos[1].ToString(), System.Globalization.NumberStyles.AllowHexSpecifier) + 1;
int blank = initial[blankColumn,blankRow];
initial.Choice(blank);
for( int j = 0; j < moveCount; j++ )
{
Puzzle.Position move = initial.CharToPosition(lines[(i + 1) * 3][j]);
if (!initial.DoMove(move))
throw new Exception();
}
}
Console.WriteLine();
for (int i = 1; i <= Problem.row; i++)
{
for (int j = 1; j <= Problem.column; j++)
{
Console.Write(initial.Data[initial.CoordToPosition(j, i)] + "\t");
}
Console.WriteLine();
}
}
示例13: OnPuzzleCreate
public override void OnPuzzleCreate(Puzzle puzzle)
{
var place = puzzle.GetPlace("PuzzlePlace");
place.SpawnSingleMob("Mob1", 120006, 3); // Young Country Rat
place.SpawnSingleMob("Mob2", 30005, 8); // White Spiderling
}
示例14: Start
// Use this for initialization
void Start()
{
progress = 0;
uiManager = GameObject.FindObjectOfType<UIManager>();
if (initialPuzzleIndex >= 0)
{
List<Puzzle> puzzleSet = new List<Puzzle>(puzzlesPrefabs.ToArray());
for (int i = 0; i < puzzleCount + remainingFailures; i++)
{
puzzlesToComplete.Add(puzzleSet[initialPuzzleIndex]);
}
currentPuzzle = SpawnPuzzle(puzzlesPrefabs[initialPuzzleIndex]);
}
else
{
List<Puzzle> puzzleSet = new List<Puzzle>(puzzlesPrefabs.ToArray());
for (int i = 0; i < puzzleCount + remainingFailures; i++)
{
int puzzleIndex = Random.Range(0, puzzleSet.Count);
puzzlesToComplete.Add(puzzleSet[puzzleIndex]);
puzzleSet.RemoveAt(puzzleIndex);
if (puzzleSet.Count == 0)
puzzleSet = new List<Puzzle>(puzzlesPrefabs.ToArray());
}
currentPuzzle = SpawnPuzzle(puzzlesToComplete[progress]);
}
SetupCurrentPuzzle();
Run();
}
示例15: run
public static String run(int[,] map2d)
{
// y1r-Solverは2xM, Nx2のパズルには対応していないため,
// この時は横長, 縦長に強いSolver1を流用する
if (Problem.row == 2 || Problem.column == 2)
{
return Solver1.run(map2d);
}
int[] puzzle = new int[Problem.partNum];
for (int i = 0; i < Problem.row; i++)
for (int j = 0; j < Problem.column; j++)
puzzle[i * Problem.column + j] = map2d[i, j];
Puzzle initial = new Puzzle( puzzle, Problem.column, Problem.row, Problem.selectionLimit, Problem.selectionCost, Problem.replacementCost);
PuzzleSolver solver = new PuzzleSolver(initial, initial);
solver.Solve();
// test(initial, solver.Puzzle.GetSolution());
Puzzle miniMap = solver.Puzzle;
return MiniPuzzleSolver.Solve(miniMap);
}