public GameObjectEditor(ProjectService projectService, PalettesService palettesService, GraphicsService graphicsService, GameObjectService gameObjectService) { InitializeComponent(); _projectService = projectService; _gameObjectService = gameObjectService; _graphicsService = graphicsService; _palettesService = palettesService; _graphicsAccessor = new GraphicsAccessor(graphicsService.GetGlobalTiles(), graphicsService.GetExtraTiles()); viewObjects.Add(viewObject); Dpi dpi = this.GetDpi(); _bitmap = new WriteableBitmap(256, 256, dpi.X, dpi.Y, PixelFormats.Bgra32, null); _renderer = new GameObjectRenderer(_gameObjectService, _palettesService, _graphicsAccessor); _renderer.RenderGrid = true; GameObjectRenderer.Source = _bitmap; List <Palette> palettes = _palettesService.GetPalettes(); ObjectSelector.Initialize(_gameObjectService, _palettesService, _graphicsAccessor, palettes[0]); PaletteSelector.ItemsSource = palettes; PaletteSelector.SelectedIndex = 0; _graphicsService.GraphicsUpdated += _graphicsService_GraphicsUpdated; _graphicsService.ExtraGraphicsUpdated += _graphicsService_GraphicsUpdated; }
public override void ShowObjectSelector() { var objectSelector = new ObjectSelector { StartPosition = FormStartPosition.CenterScreen, Text = "Select " + editedResType.Name }; objectSelector.SetTreeViewItems(ContentProvider.GetAvailableContent(editedResType) .Select(c => new Node(c.Name) { Tag = c }) .OrderBy(n => n.Text)); var result = objectSelector.ShowDialog(); if (result == DialogResult.Cancel) { return; } var selectedObject = objectSelector.SelectedObject; UpdateContentPath(selectedObject != null ? selectedObject.Path : null); }
// Use this for initialization void Start() { dungeonCanvas = GameObject.Find("Dungeon"); buttonForAtackCharging = GameObject.Find("ChargeAtackButton"); objectSelector = dungeonCanvas.GetComponent <ObjectSelector>(); dungeonManager = dungeonCanvas.GetComponent <DungeonManager>(); displayParty = dungeonCanvas.GetComponent <DisplayParty>(); dungeonsGenerator = dungeonCanvas.GetComponent <DungeonsGenerator>(); fightMode = dungeonCanvas.GetComponent <FightMode>(); buttonForAtackCharging.SetActive(false); buttonIsHeld = false; chargeReachedPeak = false; speedTimer = 0; randomNumber = new System.Random(); filePath = "UI_Elements/"; typeOfElement = new string[] { "ChargeBar", "ChargeBarPointer" }; if (GameObject.Find("FactoryObject") == null) { factoryObject = new GameObject(); factoryObject.name = "FactoryObject"; factoryObject.layer = 0; factoryObject.AddComponent <SpriteRenderer>(); Debug.Log("ButtonForChargingAtack || Start || Created new FactoryObject"); } else { Debug.Log("ButtonForChargingAtack || Start || Found FactoryObject"); factoryObject = GameObject.Find("FactoryObject"); } initializeChargeBar(); loadChargeBarSize(); }
void Start() { GameObject Controller = GameObject.FindGameObjectWithTag("Magic"); OS = Controller.GetComponent <ObjectSelector> (); grid = Controller.GetComponent <SnapToGrid> (); gameObject.GetComponent <RectTransform> ().sizeDelta = new Vector2(size * UIScaler.baseUnit, size * UIScaler.baseUnit); GameObject parent = gameObject.transform.parent.gameObject; selectedShape = parent.GetComponent <Shape> (); selectedOutline = parent.transform.GetChild(0).GetComponent <Shape> (); RectTransform parentRect = parent.GetComponent <RectTransform> (); baseWidth = parentRect.sizeDelta.x / 2; baseHeight = parentRect.sizeDelta.y / 2; Rect canvasRect = GameObject.FindGameObjectWithTag("Canvas").GetComponent <RectTransform> ().rect; Vector2 shiftPos = new Vector3(-canvasRect.width / 2, -canvasRect.height / 2, 0); sign = Mathf.Sign(gameObject.transform.localPosition.y); if (selectedShape.GetType() == typeof(Ellipse)) { float rad = Mathf.Deg2Rad * -45; // make this adjustable float c = Mathf.Cos(rad); float s = Mathf.Sin(rad); posCorrection = new Vector2(c, s); } else { posCorrection = new Vector2(1f, -1f); //make this adjustable from object selector script } }
// Use this for initialization void Start() { focusCircle.enabled = false; spriteAnimator = focusCircle.GetComponent <Animator>(); spriteAnimator.enabled = false; focusTimeoutTimer = new Timer(); focusTimeoutTimer.Interval = focusTimeoutTime; focusTimeoutTimer.Enabled = false; focusTimeoutTimer.Elapsed += TimeoutFocus; timeoutFocus = false; referWaitTimer = new Timer(); referWaitTimer.Interval = referWaitTime; referWaitTimer.Enabled = false; referWaitTimer.Elapsed += ReferToFocusedObject; timeoutFocus = false; behaviorController = GameObject.Find("BehaviorController"); objSelector = GameObject.Find("VoxWorld").GetComponent <ObjectSelector>(); preds = behaviorController.GetComponent <Predicates>(); eventManager = behaviorController.GetComponent <EventManager>(); relationTracker = behaviorController.GetComponent <RelationTracker>(); eventManager.EntityReferenced += ReferenceObject; PlaceObjects += PlaceObjectsRandomly; ObjectSelected += IndicateFocus; }
// Use this for initialization void Start() { mm = FindObjectOfType <ObjectSelector>(); OrbitButton = GameObject.Find("NewPlanet"); yPlane = new Plane(new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f)); mainCamera = GameObject.FindObjectOfType <Camera>().GetComponent <Camera>(); }
private static void AddAssetOnTrack(Type typeOfClip, TrackAsset track, ITimelineState state) { state.AddStartFrameDelegate(delegate(ITimelineState istate, Event currentEvent) { ObjectSelector.get_get().Show(null, typeOfClip, null, false); ObjectSelector.get_get().objectSelectorID = 0; ObjectSelector.get_get().set_searchFilter(""); return(true); }); state.AddStartFrameDelegate(delegate(ITimelineState istate, Event currentEvent) { bool result; if (currentEvent.get_commandName() == "ObjectSelectorClosed") { AnimationTrack animationTrack = track as AnimationTrack; if (animationTrack && !animationTrack.inClipMode) { animationTrack.ConvertToClipMode(); } TimelineClip timelineClip = TimelineHelpers.CreateClipOnTrack(EditorGUIUtility.GetObjectPickerObject(), track, istate, TimelineHelpers.sInvalidMousePosition); if (timelineClip != null && timelineClip.asset != null) { TimelineCreateUtilities.SaveAssetIntoObject(timelineClip.asset, track); } result = true; } else { result = false; } return(result); }); }
private static ObjectSelector GenerateDefaultObjectSelector() { ObjectSelector gos = new ObjectSelector(); gos.Roles.Script = true; gos.Views.Script = true; gos.UserDefinedFunctions.Script = true; gos.UserDefinedDataTypes.Script = true; gos.UserDefinedTableTypes.Script = true; gos.StoredProcedures.Script = true; gos.Triggers.Script = true; gos.Schemas.Script = true; gos.SchemaCollections.Script = false; gos.Tables.Script = true; //SQLObject obj = new SQLObject(); //obj.Script = true; //obj.RegexExpression = true; //obj.Schema = ".*"; //obj.Name = ".*"; //gos.Tables.SQLObjects.Add(obj); //string ttt = CommonFunc.SerializeToXmlString(gos); //System.Diagnostics.Debug.WriteLine(ttt); return(gos); }
IEnumerator CreateLine() { StopCoroutine(CreateLine()); GameObject nodeOne; GameObject nodeTwo; ObjectSelector.SelectionUsed(); ObjectSelector.ResetSelectedObject(); Msg(LocalizationManager.Localize("chooseFirstNode")); do { yield return(new WaitUntil(ObjectSelector.IsJustSelected)); nodeOne = ObjectSelector.SelectNode(); }while (nodeOne == null); Msg(LocalizationManager.Localize("chooseSecondNode")); do { yield return(new WaitUntil(ObjectSelector.IsJustSelected)); nodeTwo = ObjectSelector.SelectNode(); }while (nodeTwo == null); newLine = Instantiate(LinePrefab); line = newLine.GetComponent <LineRenderer>(); line.SetPosition(0, nodeOne.transform.position); line.SetPosition(1, nodeTwo.transform.position); newLine.GetComponent <LineSelector>().firstNode = nodeOne; newLine.GetComponent <LineSelector>().lastNode = nodeTwo; }
IEnumerator DeleteObject() { StopCoroutine(DeleteObject()); GameObject obj; ObjectSelector.SelectionUsed(); ObjectSelector.ResetSelectedObject(); Msg(LocalizationManager.Localize("chooseObjectToDelete")); do { yield return(new WaitUntil(ObjectSelector.IsJustSelected)); obj = ObjectSelector.SelectObject(); }while (obj == null); Shure.SetActive(true); yield return(new WaitUntil(() => done)); if (answer) { Destroy(obj); done = false; } else { done = false; } }
private void Start() { _objectSelector = GetComponent <ObjectSelector>(); left_joystick_handle = left_joystick.GetComponent <FixedJoystick>(); right_joystick_handle = right_joystick.GetComponent <FixedJoystick>(); vertical_joystick_handle = vertical_joystick.GetComponent <FixedJoystick>(); }
public void ProcessClick(GameObject hitObject) { if (hitObject.tag == "Tile") { if (ObjectSelector.SelectedObject) { Tile tile = ObjectSelector.SelectedObject.GetComponentInParent <Tile>(); if (tile) { int x = (int)hitObject.transform.position.x; int y = (int)hitObject.transform.position.z; if (gameBoard[x, y] == null) { if (tile.CanMoveTo(x, y)) { if (useNetwork) { networkManager.SendMoveRequest(tile.Index, x, y); } gameBoard[tile.x, tile.y] = null; tile.Move(x, y); gameBoard[x, y] = tile; } } } } } else { Tile tile = hitObject.GetComponentInParent <Tile>(); if (tile) { if (choosingInteraction) { Tile selectedTile = ObjectSelector.SelectedObject?.GetComponentInParent <Tile>(); if (selectedTile) { if (AreNeighbors(tile, selectedTile) && tile.Owner != selectedTile.Owner) { if (useNetwork) { networkManager.SendInteractRequest(selectedTile.Index, tile.Index); } selectedTile.Interact(tile); choosingInteraction = false; } } } else if (tile.gameObject == ObjectSelector.SelectedObject) { ObjectSelector.SetSelectedObject(null); } else if (tile.Owner.IsMouseControlled && tile.Owner == Players[currentPlayer - 1]) { ObjectSelector.SetSelectedObject(hitObject); } } } }
public void ProcessClick(GameObject hitObject) { if (hitObject.tag == "Tile") { if (ObjectSelector.SelectedObject) { Hero hero = ObjectSelector.SelectedObject.GetComponentInParent <Hero>(); if (hero) { int x = (int)hitObject.transform.position.x; int y = (int)hitObject.transform.position.z; if (gameBoard[x, y] == null) { if (hero.CanMoveTo(x, y)) { if (useNetwork) { networkManager.SendMoveRequest(hero.Index, x, y); } gameBoard[hero.x, hero.y] = null; hero.Move(x, y); gameBoard[x, y] = hero; } } } } } else { Hero hero = hitObject.GetComponentInParent <Hero>(); if (hero) { if (choosingInteraction) { Hero selectedHero = ObjectSelector.SelectedObject?.GetComponentInParent <Hero>(); if (selectedHero) { if (AreNeighbors(hero, selectedHero) && hero.Owner != selectedHero.Owner) { if (useNetwork) { networkManager.SendInteractRequest(selectedHero.Index, hero.Index); } selectedHero.Interact(hero); choosingInteraction = false; } } } else if (hero.gameObject == ObjectSelector.SelectedObject) { ObjectSelector.SetSelectedObject(null); } else if (hero.Owner.IsMouseControlled && hero.Owner == Players[currentPlayer - 1]) { ObjectSelector.SetSelectedObject(hitObject); } } } }
private void Button_Click_1(object sender, RoutedEventArgs e) { TrimMainObjectSearch search = new TrimMainObjectSearch(_database, BaseObjectTypes.Record); search.SelectAll(); ObjectSelector.DisplayResults(GetDesktopWindow(), search); }
private void PaletteSelector_SelectionChanged(object sender, SelectionChangedEventArgs e) { Palette selectedPalette = _palettesService.GetPalette(((Palette)PaletteSelector.SelectedItem).Id); _renderer.Update(selectedPalette); ObjectSelector.Update(selectedPalette); Update(); }
// Use this for initialization void Start() { em = gameObject.GetComponent <EventManager>(); commBridge = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>(); objectSelector = GameObject.Find("VoxWorld").GetComponent <ObjectSelector>(); em.QueueEmpty += QueueEmpty; }
// Use this for initialization void Start() { mm = GameObject.FindObjectOfType <ObjectSelector>(); mc = GameObject.FindObjectOfType <MoveCamera>(); camObj = GameObject.Find("Main Camera"); cam = mc.GetComponent <Camera>(); mo = GameObject.Find("MouseOver"); selector = GameObject.Find("Selector"); }
public static void ResolveAllPhysicsDiscrepancies(bool macroEventSatisfied) { ObjectSelector objSelector = GameObject.Find("VoxWorld").GetComponent <ObjectSelector>(); foreach (Voxeme voxeme in objSelector.allVoxemes) { ResolvePhysicsDiscrepancies(voxeme.gameObject, macroEventSatisfied); } }
public static string SwitchPredicate(List <Triple <string, string, int> > alternateList, Hashtable predArgs, string pred) { UnderspecificationVideoAutoCapture vidCap = Camera.main.GetComponent <UnderspecificationVideoAutoCapture>(); ObjectSelector objSelector = GameObject.Find("VoxWorld").GetComponent <ObjectSelector>(); string outValue = string.Empty; Triple <string, string, int> alternate = alternateList[RandomHelper.RandomInt(0, alternateList.Count, (int)RandomHelper.RangeFlags.MinInclusive)]; string altPred = alternate.Item1; string adjunct = alternate.Item2; int arity = alternate.Item3; if (arity == 1) { string directObjName = predArgs[pred].ToString(); if (adjunct == string.Empty) { outValue = string.Format("{0}({1})", altPred, directObjName); } else { outValue = string.Format("{0}({1},{2}({1}))", altPred, directObjName, adjunct); } } else if (arity == 2) { string directObjName = predArgs[pred].ToString(); GameObject directObj = GameObject.Find(directObjName) != null ? GameObject.Find(directObjName) : objSelector.disabledObjects.Find(o => o.name == directObjName); GameObject obj = RandomHelper.RandomVoxeme(vidCap.availableObjs, new List <GameObject>() { directObj }); // while (Helper.GetMostImmediateParentVoxeme (obj).gameObject.transform.parent != null) { // obj = RandomHelper.RandomVoxeme (vidCap.availableObjs, new List<GameObject>(){ GameObject.Find (directObj) }); // Debug.Log (obj.name); // } string indirectObjName = obj.name; if (adjunct == string.Empty) { outValue = string.Format("{0}({1},{2})", altPred, directObjName, indirectObjName); } else { outValue = string.Format("{0}({1},{2}({3}))", altPred, directObjName, adjunct, indirectObjName); } } return(outValue); }
public static T[] DoDropField <T>(Rect position, int id, ObjectSelector <T> selector, GUIStyle style) { var evt = Event.current; var eventType = evt.type; if (!GUI.enabled && (Event.current.rawType == EventType.MouseDown)) { eventType = Event.current.rawType; } switch (eventType) { case EventType.DragExited: if (GUI.enabled) { HandleUtility.Repaint(); } break; case EventType.DragUpdated: case EventType.DragPerform: { if (position.Contains(Event.current.mousePosition) && GUI.enabled) { var validatedObject = selector(DragAndDrop.objectReferences); if (validatedObject.Length > 0) { DragAndDrop.visualMode = DragAndDropVisualMode.Generic; if (eventType == EventType.DragPerform) { GUI.changed = true; DragAndDrop.AcceptDrag(); DragAndDrop.activeControlID = 0; Event.current.Use(); return(validatedObject); } DragAndDrop.activeControlID = id; } } } break; case EventType.Repaint: { style.Draw(position, GUIContent.none, id, DragAndDrop.activeControlID == id); } break; } return(null); }
// Enforce the singleton pattern private void Awake() { if (instance == null || instance == this) { instance = this; } else { Destroy(this); } }
void Update() { if (!ObjectMenuTextInput.active) { if (Input.GetKeyDown(KeyCode.L)) { StartCoroutine(CreateLine()); } if (Input.GetKeyDown(KeyCode.Delete)) { StartCoroutine(DeleteObject()); } if (Input.GetKeyDown(KeyCode.I)) { StartCoroutine(CreateNode()); } /*if (Input.GetKeyDown(KeyCode.O)) * { * if (Instruction.activeSelf) * Instruction.SetActive(false); * else Instruction.SetActive(true); * }*/ } if (Input.GetKeyDown(KeyCode.Escape)) { if (ObjectSelector.GetSelectedObject() != null) { ObjectSelector.SetSelectedObject(null); } else { if (!menuOpen) { OpenMenu(); } else { CloseMenu(); } } } if (ObjectSelector.GetSelectedObject() != null) { OpenObjectMenu(); } else { CloseObjectMenu(); } }
void Start() { gameObject.GetComponent <Camera>().targetTexture = (RenderTexture)VisionCanvas.GetComponentInChildren <RawImage>().texture; interactionPrefs = world.GetComponent <InteractionPrefsModalWindow>(); if (attached != null) { gameObject.transform.SetParent(attached); } objSelector = GameObject.Find("VoxWorld").GetComponent <ObjectSelector>(); // visibleObjects = new HashSet<Voxeme>(); }
void Update() { if (ObjectSelector.GetSelectedObject().tag == "Node") { ObjectMenuDecompose.SetActive(true); ObjectMenuText.SetActive(true); } else { ObjectMenuDecompose.SetActive(false); ObjectMenuText.SetActive(false); } }
/// <summary> /// /// </summary> private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } _rayCaster = Camera.main; DontDestroyOnLoad(gameObject); }
// Use this for initialization void Start() { dungeonCanvas = GameObject.Find("Dungeon"); dungeonManager = dungeonCanvas.GetComponent <DungeonManager>(); dungeonsGenerator = dungeonCanvas.GetComponent <DungeonsGenerator>(); enemyGenerator = dungeonCanvas.GetComponent <EnemyGenerator>(); buttonForCameraMovement = GameObject.Find("MoveRightButton").GetComponent <ButtonForCameraMovement>(); buttonForUsage = GameObject.Find("UseButton").GetComponent <ButtonForUsage>(); objectSelector = dungeonCanvas.GetComponent <ObjectSelector>(); displayParty = dungeonCanvas.GetComponent <DisplayParty>(); partyIsInFightMode = false; enemyPossitionsBeforeFight = new float[4]; colidedWithPartyNumber = 0; }
protected void InitObjects() { var length = ObjectLength; Objects = new List <ObjectSelector>(length); For (length, (i) => { var newSelector = new ObjectSelector (ObjectModes[i], ObjectNames[i]); Objects.Add(newSelector); }); }
/// <summary> /// Runs create new model procedure. /// </summary> public void AddNewObjectUI() { string name = ""; while (true) { Type type = baseType; if (extraTypes.Length > 1) { if (ObjectSelector.Show(this, "Select class", "Add", extraTypes.ToDictionary(tt => tt.Name), out type)) { } else { return; } } name = NameDialog.Show(this, "Create new " + objectName + ":", "Add " + objectName, name); if (name == null) { return; } var fullPath = Path.Combine(fullSourceFolder, name + ".xml"); if (File.Exists(fullPath)) { var r = MessageBox.Show(this, string.Format("{0} '{1}' already exists", objectName, name), "Add", MessageBoxButtons.OKCancel); if (r == DialogResult.OK) { continue; } else { return; } } var newObject = Activator.CreateInstance(type); File.WriteAllText(fullPath, Misc.SaveObjectToXml(newObject, baseType, extraTypes)); RefreshFileList(); return; } }
public void TextInputStart() { objectForTexting = ObjectSelector.GetSelectedObject(); if (ObjectMenuTextInput.activeSelf) { ObjectMenuTextInput.SetActive(false); } else { ObjectMenuTextInput.GetComponent <TMP_InputField>().text = ObjectSelector.GetSelectedObject().GetComponentInChildren <TMP_Text>().text; ObjectMenuTextInput.SetActive(true); } }
private void Origin_Chooser_Button_Click(object sender, RoutedEventArgs e) { // First filter the Origins to select from and then allow the user to choose an Origin TrimMainObjectSearch search = new TrimMainObjectSearch(Database, BaseObjectTypes.Origin); search.SetSearchString(string.Format("ognType:{0}", OriginType.WindowsFolder)); SelectedOrigin = ObjectSelector.SelectOne(GetDesktopWindow(), search) as Origin; if (string.IsNullOrEmpty(SourceFolder)) { SourceFolder = SelectedOrigin.OriginLocation; } }
void Start() { eventManager = gameObject.GetComponent<EventManager> (); aStarSearch = GameObject.Find ("BlocksWorld").GetComponent<AStarSearch> (); objSelector = GameObject.Find ("BlocksWorld").GetComponent<ObjectSelector> (); macros = GameObject.Find ("BehaviorController").GetComponent<Macros> (); }
// Use this for initialization void Start() { assetManager = GameObject.Find ("AssetManager").GetComponent ("AssetManager") as AssetManager; objectSelector = GameObject.Find ("ObjectSelector").GetComponent ("ObjectSelector") as ObjectSelector; objectList = GameObject.Find ("ObjectList").GetComponent ("ObjectList") as ObjectList; parameterList = GameObject.Find ("ParameterList").GetComponent ("ParameterList") as ParameterList; colors = new Color[]{Color.white,Color.white,Color.white,Color.white}; tex = new Texture2D (2, 2); // Make a GUIStyle that has a solid white hover/onHover background to indicate highlighted items listStyle.normal.textColor = Color.white; tex.SetPixels(colors); tex.Apply(); listStyle.hover.background = tex; listStyle.onHover.background = tex; listStyle.padding.left = listStyle.padding.right = listStyle.padding.top = listStyle.padding.bottom = 4; }
// Use this for initialization void Start() { objSelector = GameObject.Find ("ObjectSelector").GetComponent ("ObjectSelector") as ObjectSelector; objList = GameObject.Find ("ObjectList").GetComponent ("ObjectList") as ObjectList; }
// Use this for initialization void Start() { preds = gameObject.GetComponent<Predicates> (); objSelector = GameObject.Find ("BlocksWorld").GetComponent<ObjectSelector> (); }
void Start() { GameObject bc = GameObject.Find ("BehaviorController"); eventManager = bc.GetComponent<EventManager> (); macros = bc.GetComponent<Macros> (); objSelector = GameObject.Find ("BlocksWorld").GetComponent<ObjectSelector> (); commBridge = GameObject.Find ("CommunicationsBridge").GetComponent<PluginImport> (); //inputRect = new Rect (5, 5, 50, 25); inputRect = new Rect (5, 5, 365, inputHeight); }