private void CreateIOHooks(RectTransform parent, GameObject prefab, IVariableHook[] hooks) { foreach (var io in hooks) { GameObject newHook = Instantiate(prefab, parent); newHook.GetComponent <HookAttachment> ().Initialize(io as IHook, TypeColors.GetColor(io.ValueType)); } }
public Brush GetBaseColor(Type type) { Brush outp; bool good = TypeColors.TryGetValue(type, out outp); if (good) { return(outp); } else { return(Brushes.White); } }
public override void LoadFrom(Node source) { void InstantiateValueHooks(IEnumerable <IVariableHook> hooks, GameObject prefabObject, Transform parent) { foreach (var hook in hooks) { InstantiateHook(hook, prefabObject, parent, TypeColors.GetColor(hook.ValueType)); } } void InstantiateHook(IHook hook, GameObject prefabObject, Transform parent, Color color) { GameObject newHookWidget = Instantiate(prefabObject, parent); HookAttachment hookAttachment = newHookWidget.GetComponent <HookAttachment>(); hookAttachment.Initialize(hook, color); } if (source is IHasInput input) { InstantiateValueHooks(input.InputHooks, HookAttachment.LeftHookWidget.Get(), inputSide); } else { Destroy(inputSide.gameObject); } if (source is IHasOutput output) { InstantiateValueHooks(output.OutputHooks, HookAttachment.RightHookWidget.Get(), outputSide); } else { Destroy(outputSide.gameObject); } if (source is IFlowNode flowNode) { foreach (var hook in flowNode.PossibleRoutes) { InstantiateHook(hook, FlowOutputHook.Get(), flowSide, Color.white); } } else { Destroy(flowSide.gameObject); } }
public MazeCircuitMenuViewModel() { this.nav = SimpleIoc.Default.GetInstance <INavigation>(); this.pss = SimpleIoc.Default.GetInstance <ActionRobot>(); this.currentType = TypeMazeGame.Null; this.PreviousViewModelCommand = new RelayCommand(this.GoBack); this.HomeViewModelCommand = new RelayCommand(this.GoHome); this.ChangeExerciceTypeCommand = new RelayCommand <int>(this.ChangeExerciceType); this.ChangerCouleurCommand = new RelayCommand <int>(this.ChangerCouleur); this.StartCommand = new RelayCommand(this.StartGame, this.Start_CanExecute); this.StopCommand = new RelayCommand(this.StopGame, this.Stop_CanExecute); this.PauseCommand = new RelayCommand(this.PauseGame, this.Stop_CanExecute); // De base aucun type n'est coché donc le menu n'est pas accessible this.MenuEnabled = false; this.NewCircuitEnabled = false; // Création de la liste de radio button pour la séléction du circuit this.CircuitsEnabled = false; this.CircuitsCheck = new ObservableCollection <CircuitRadio>(); for (int i = 1; i < 9; i++) { var radio = new CircuitRadio(i.ToString()); this.CircuitsCheck.Add(radio); } this.pathToFile = "Files/Patients/" + singleton.Patient.Nom + singleton.Patient.Prenom + singleton.Patient.DateDeNaissance.ToString().Replace("/", string.Empty) + "/Maze_Circuit"; this.ErrorPlotPoint = new List <DataPoint>(); this.VitessePlotPoint = new List <DataPoint>(); this.MaxRepetionPlot = 10; this.currentColor = TypeColors.Default; this.inPause = false; }
/// <summary> /// Change l'interface en fonction du type d'exercice séléctionné /// </summary> /// <param name="type"></param> private void ChangerCouleur(int type) { this.currentColor = (TypeColors)type; }
public PuzzlePieceAttribute(string piecename, TypeColors typeColors) { this.piecename = piecename; this.typeColors = typeColors; }
public static Color GetColorFromColorType(TypeColors tc) { return colors[ExtensionMethods.IntegerBinaryLog((ulong) tc)]; }
public static Gdk.Pixbuf GeneratePuzzlePiece(TypeColors tc, int size) { Gdk.Pixbuf pb; using (ImageSurface imsu = new ImageSurface (Format.ARGB32, size, size)) { using (Context ctx = new Context (imsu)) { ctx.Color = White; ctx.Paint (); double x1 = 0.9d * size, x0 = size - x1, x2 = 0.35d * size, x3 = 0.55d * size, x4 = 0.45d * size; ctx.MoveTo (0.0d, x0); ctx.LineTo (x2, x0); ctx.Arc (x4, x0, x0, Math.PI, 2.0d * Math.PI); ctx.LineTo (x1, x0); ctx.LineTo (x1, x2 + x0); ctx.Arc (x1, x4 + x0, x0, 1.5d * Math.PI, 2.5d * Math.PI); ctx.LineTo (x1, size); ctx.LineTo (x3, size); ctx.ArcNegative (x4, size, x0, 2.0d * Math.PI, Math.PI); ctx.LineTo (0.0d, size); ctx.LineTo (0.0d, x3 + x0); ctx.ArcNegative (0.0d, x4 + x0, x0, 2.5d * Math.PI, 1.5d * Math.PI); ctx.ClosePath (); ctx.Pattern = ExtensionMethods.GenerateColorSequencePattern (size, tc); ctx.Fill (); byte a, r, g, b; byte[] dat = new byte[imsu.Data.Length]; for (int i = 0, j = 0; i < dat.Length;) { b = imsu.Data [i++]; g = imsu.Data [i++]; r = imsu.Data [i++]; a = imsu.Data [i++]; dat [j++] = r; dat [j++] = g; dat [j++] = b; dat [j++] = a; } pb = new Gdk.Pixbuf(dat,Gdk.Colorspace.Rgb,true,8,size,size,imsu.Stride); } } return pb; }
public virtual void Initialize(ValueNode valueNode) { valueNode.OnDeleted += () => { Destroy(gameObject); }; ValueNode = valueNode; OutputHookWidget.Initialize(OutputHook, TypeColors.GetColor(ValueNode.ValueType)); }