public void Setup(PropertyInfo propertyInfo, object classObject, WorldSpaceUI UI) { this.PropertyInfo = propertyInfo; this.ClassObject = classObject; this.UI = UI; }
public InputElements CreateInputCanvas(object value, int id, WorldSpaceUI worldSpaceUI, bool isVariable, string name = "constant") { GameObject obj = GameObject.Instantiate(this.constantAndVariablePanelPrefab); Canvas can = obj.GetComponent <Canvas>(); can.worldCamera = this.camera; GameObject buttonGo = obj.transform.Find("Button").gameObject; Button button = buttonGo.GetComponent <Button>(); GameObject textGO = buttonGo.transform.Find("Text").gameObject; TMP_Text text = textGO.GetComponent <TMP_Text>(); if (isVariable) { text.text = name; } else { text.text = value.ToString(); } DirectInputNode nodeBe = buttonGo.AddComponent <DirectInputNode>(); RectTransform rt = obj.GetComponent <RectTransform>(); InputElements result = new InputElements(obj, text, nodeBe, rt, button, id); obj.transform.SetParent(this.localParent); ///element scaling! rt.localScale *= this.constantsScale; nodeBe.Setup(value, id, worldSpaceUI, result, isVariable, name); this.inputs.Add(result); return(result); }
protected virtual void Start() { // floor! GameObject baseCylindcer = ReferenceBuffer.Instance.gl.CylinderBasePrefab(new Vector3(40, 1, 40), true); // player and cam! this.player = ReferenceBuffer.Instance.gl.Player(new Vector3(0, 0, 10), true, true, true); this.mainCamera = GameObject.Find("MainCamera"); this.mainSpellCamera = GameObject.Find("Camera"); /// second cam is Camera2 this.secondSpellCamera = GameObject.Find("Camera2"); CamHandling camHandling = this.mainCamera.GetComponent <CamHandling>(); camHandling.target = this.player.transform; // spellcraft SpellcraftProcUI procUI = gameObject.AddComponent <SpellcraftProcUI>(); this.worldSpaceUI = gameObject.AddComponent <WorldSpaceUI>(); this.worldSpaceUI.Setup(new Vector3(0, -40, 0)); this.worldSpaceUI.LoadLevel = false; ReferenceBuffer.Instance.RegisterWorldSapceUI(this.worldSpaceUI); // drone setup this.droneCamGO = GameObject.Find("DroneCamera"); this.droneCamGO.GetComponent <Camera>().enabled = false; this.droneCamGO.transform.position = new Vector3(5, 5, 5); this.droneCamGO.AddComponent <Drone>(); this.droneCamGO.SetActive(false); }
void Start() { navMeshAgent = GetComponent <NavMeshAgent>(); col = GetComponent <Collider>(); player = GetComponent <Player>(); ui = GetComponentInChildren <WorldSpaceUI>(); updateAction = DefaultControl; }
public DynamicSetup(ClassVisualisation classVisualisation, WorldSpaceUI UI, ResultCanvas resultCanvas, InputCanvas inputCanvas) { this.classVisualisation = classVisualisation; this.UI = UI; //this.resultCanvas = resultCanvas; this.inputCanvas = inputCanvas; this.posOffset = new Vector3(5, 5, 5); }
public void Setup(MyParameterInfo PropertyInfo, MethodInfo myMethod, object ClassObject, WorldSpaceUI UI, Node classNode) { this.ParameterInfo = PropertyInfo; this.Object = ClassObject; this.myMethod = myMethod; this.ID = PropertyInfo.ID; this.UI = UI; this.ClassNode = classNode; }
public void Setup(MyMethodInfo methodInfo, MyParameterInfo[] myParamaters, object classObject, WorldSpaceUI UI, Node classNode) { this.MyMethodInfo = methodInfo; this.MyParamaters = myParamaters; this.Object = classObject; this.UI = UI; this.ID = methodInfo.ID; this.type = methodInfo.Info.ReturnType; this.ClassNode = classNode; }
void DefaultControl() { // Movement control if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { navMeshAgent.SetDestination(hit.point); if (hit.transform.GetComponent <Interactable>()) { interactTarget = hit.transform.GetComponent <Interactable>(); } } } if (interactTarget != null) { if (Vector3.Distance(transform.position, interactTarget.transform.position) < 3f) { interactTarget.OnInteract(player); interactTarget = null; } } // UI Control if (Input.GetKeyDown(KeyCode.I)) { navMeshAgent.SetDestination(transform.position); ui.UpdateInventoryItems(); // Show players's inventory ui.ToggleInventoryView(); // Show any nearby inventories openUI.Clear(); Collider[] colliders = Physics.OverlapSphere(transform.position, 5f); foreach (Collider colliderOther in colliders) { if (colliderOther != col) { WorldSpaceUI objectUI = colliderOther.transform.GetComponentInChildren <WorldSpaceUI>(); if (objectUI != null) { objectUI.ToggleInventoryView(); objectUI.UpdateInventoryItems(); openUI.Add(objectUI); } } } updateAction = InventoryControl; } }
public Setups(ResultCanvas resultCanvas, InputCanvas inputCanvas, ConnectionsRegisterer connRegisterer, WorldSpaceUI UI, ResultNode resultNode, ClassVisualisation classVisualisation) { this.resultCanvas = resultCanvas; this.inputCanvas = inputCanvas; this.connRegisterer = connRegisterer; this.UI = UI; this.classVisualisation = classVisualisation; this.resultNode = resultNode; ///Setup the result! this.resultNode.Setup(typeof(int), this.UI); }
public IEnumerator TestLevelWorks() { GameObject camera = new GameObject("Camera"); camera.AddComponent <Camera>(); GameObject main = new GameObject("Main"); WorldSpaceUI worldSpaceUI = main.AddComponent <WorldSpaceUI>(); worldSpaceUI.inputPanelPrefab = GetInputCanvasPrefab(); worldSpaceUI.resultAndVariablesPanelPrefab = GetResultCanvasPrefab(); worldSpaceUI.transperantMat = GetTransperantMatPrefab(); worldSpaceUI.worldSpaceTextPrefab = WorldSpaceTextPrefab(); yield return(null); }
public static WorldSpaceUI showUI(Vector3 position) { position = position + new Vector3(0, 2, 0); if (currentUI == null) { GameObject o = GameManager.spawnPrefab(GameManager.getGameManager()._worldSpaceUIPrefab, position, ReuseableGameObject.WORLD_SPACE_UI); currentUI = o.GetComponent <WorldSpaceUI>(); //o.transform.SetParent(GameManager.getGameManager()._worldSpaceUIHolder, false); } else { currentUI.transform.position = position; } currentUI.removeAllButtons(); return(currentUI); }
public static void onPlayerRightClickItem(Player player, Item item) { WorldSpaceUI ui = WorldSpaceUIHandler.showUI(item.getLocation().getVector3()); ui.addButton("Pick Up", () => { Debug.Log("item removed"); item.remove(); player.giveItem(item.getItemStack()); WorldSpaceUIHandler.hideUI(); }); foreach (CraftingRecipe recipe in CraftingHandler.getCraftableRecipes(CraftingRecipeType.FLOOR, item.getNearbyItemStack(3f))) { ui.addButton("Craft " + recipe.requiredItems.GetType(), () => { if (CraftingHandler.tryFloorCraft(recipe, item.getLocation().getVector3()) == null) { Debug.Log("failed!"); } WorldSpaceUIHandler.hideUI(); }); } }
public void Setup(object value, int ID, WorldSpaceUI UI, InputCanvas.InputElements elements, bool isVariable = false, string variableName = "constant") { this.value = value; this.UI = UI; this.elements = elements; this.isVariable = isVariable; this.VariableName = variableName; this.ID = ID; ///Reusing the Constant code for variables too, will fix semantics later if (this.isVariable) { this.originalColor = Color.Lerp(Color.red, Color.yellow, 0.5f).SetAlpha(); this.elements.Button.GetComponent <Image>().color = this.originalColor; } else { this.originalColor = this.elements.Button.GetComponent <Image>().color; } gameObject.GetComponent <Button>().onClick.AddListener(this.OnClick); }
private void Start() { // Floor! GameObject baseCylindcer = ReferenceBuffer.Instance.gl.CylinderBasePrefab(new Vector3(40, 1, 40), true); // Player and cam! this.player = ReferenceBuffer.Instance.gl.Player(new Vector3(0, 0, 10), true, true, true); this.mainCamera = GameObject.Find("MainCamera"); this.mainSpellCamera = GameObject.Find("Camera"); /// second cam is Camera2 this.secondSpellCamera = GameObject.Find("Camera2"); CamHandling camHandling = this.mainCamera.GetComponent <CamHandling>(); camHandling.target = this.player.transform; //... var procUI = gameObject.AddComponent <SpellcraftProcUI>(); this.worldSpaceUI = gameObject.AddComponent <WorldSpaceUI>(); this.worldSpaceUI.Setup(new Vector3(0, -40, 0)); // LOADLEVEL_DECLARED_HERE this.worldSpaceUI.LoadLevel = false; ReferenceBuffer.Instance.RegisterWorldSapceUI(this.worldSpaceUI); this.droneCamGO = GameObject.Find("DroneCamera"); this.droneCamGO.GetComponent <Camera>().enabled = false; this.droneCamGO.transform.position = new Vector3(5, 5, 5); this.droneCamGO.AddComponent <Drone>(); this.droneCamGO.SetActive(false); GameObject toDestroy = GameObject.CreatePrimitive(PrimitiveType.Cylinder); toDestroy.tag = "destroy"; toDestroy.transform.position = new Vector3(0, 0, 0); var rb = toDestroy.AddComponent <Rigidbody>(); rb.useGravity = false; rb.isKinematic = true; }
public void RegisterWorldSapceUI(WorldSpaceUI worldSpaceUI) { this.worldSpaceUI = worldSpaceUI; }
public CubePersistance(WorldSpaceUI UI) { this.UI = UI; }
public ConnectionsTracker(WorldSpaceUI UI) { this.persistance = new CubePersistance(UI); }
public static void hideUI() { ReuseGameObjectHandler.putToRecycle(ReuseableGameObject.WORLD_SPACE_UI, currentUI.gameObject); currentUI = null; }
public ClassVisualisation(WorldSpaceUI UI) { this.UI = UI; }
public void Setup(Type type, WorldSpaceUI UI) { this.type = type; this.UI = UI; }
public LineDrawer(WorldSpaceUI UI) { this.UI = UI; }