public GraphicalInteger(string name, Parser.Integer val, Vector3 dimensions, Vector3 position, int representation) // representation : 0 -> dans une liste, 1 -> un index pointant sur une valeur de liste, 2 -> ... { this.name = name; this.val = val; this.dimensions = dimensions; this.position = position; this.representation = representation; }
public void insert(Parser.Integer index, Parser.Variable value) { list.insertValue(value, index); float time_animation = 2f; GameObject[] obj_list = new GameObject[list.length().getValue() - index.getValue() - 1]; for (int i = index.getValue() + 1, u = 0; i < list.length().getValue(); i++, u++) { obj_list[u] = list_dict[list.atIndex(new Parser.Integer(i)).getName()]; } StartCoroutine(Animation.insertAnimation(obj_list, value.getName(), new Vector3(1, 0, 0), time_animation, 1, this)); }
public void remove(Parser.Integer index) { string name = list.atIndex(index).getName(); float time_animation = 3f; Destroy(list_dict[name], time_animation / 2f); list.removeValue(index); GameObject[] obj_list = new GameObject[list.length().getValue() - index.getValue()]; for (int i = index.getValue(), u = 0; i < list.length().getValue(); i++, u++) { obj_list[u] = list_dict[list.atIndex(new Parser.Integer(i)).getName()]; } StartCoroutine(Animation.removeAnimation(obj_list, name, new Vector3(-1, 0, 0), time_animation, 0, this)); }
public void swap(Parser.Integer index1, Parser.Integer index2) { Parser.Variable obj1_val = list.atIndex(index1); string obj1_name = list.atIndex(index1).getName(); Parser.Variable obj2_val = list.atIndex(index2); string obj2_name = list.atIndex(index2).getName(); list.removeValue(index1); list.insertValue(obj2_val, index1); list.atIndex(index1).setName(obj2_name); list.removeValue(index2); list.insertValue(obj1_val, index2); list.atIndex(index2).setName(obj1_name); StartCoroutine(Animation.swap(list_dict[obj1_name], list_dict[obj2_name], 2f, this)); }