コード例 #1
0
ファイル: UICompass.cs プロジェクト: hafewa/MinimalUI
        // protected override void OnMarkerRemove(MapMarker marker) {

        // }
        // protected override
        void OnMarkerAdd(MapMarker marker)
        {
            marker.ShowMessage(false);
            marker.ShowDistance(false);
            marker.ShowDirectionals(!UIMaps.RegisteredObjectIsPlayer(marker.uIRegisteredObject));
            marker.showRotation = false;
        }
コード例 #2
0
ファイル: UIManager.cs プロジェクト: hafewa/MinimalUI
        static void InitializeUIManager()
        {
            UIMaps.InitializeMaps();

            eventSystem.sendNavigationEvents = true;

            inputModule.gameObject.SetActive(false);

            SaveLoad.onSettingsOptionsLoaded += OnSettingsOptionsLoaded;
            SaveLoad.onSaveSettingsOptions   += OnSaveSettingsOptions;
        }
コード例 #3
0
        public void RegisterWithUI()
        {
            registeredUIObj = UIMaps.RegisterStaticObjectWithUI(registerKey, transform.position, transform.forward, message, miniMapIconName, mainMapIconName, compassIconName, worldViewIconName, true);

            registeredUIObj.ShowMapType(UIMapsObject.ShowType.MainMap, true);

            // if we're registered with ui throug this script, it means we've loaded locally
            // so add to the mini map / compass
            registeredUIObj.ShowMapType(UIMapsObject.ShowType.MiniMap, true);
            registeredUIObj.ShowMapType(UIMapsObject.ShowType.Compass, true);
        }
コード例 #4
0
        void OnEnable()
        {
            if (registerOnEnable)
            {
                RegisterWithUI();
            }
            else
            {
                // check if we're alreaady registered anyways

                if (UIMaps.StaticObjectRegistered(registerKey, out registeredUIObj))
                {
                    RegisterWithUI();
                }
            }
        }
コード例 #5
0
 void RegisterWithUI()
 {
     registeredUIObj = UIMaps.RegisterDynamicObjectWithUI(gameObject.name, GetInstanceID(), transform.position, transform.forward, message, miniMapIconName, mainMapIconName, compassIconName, worldViewIconName);
     registeredUIObj.SetWorldPositionGetter(() => transform.position);
     registeredUIObj.SetWorldForwardGetter(() => transform.forward);
 }
コード例 #6
0
 public void DeregisterWithUI()
 {
     registeredUIObj = UIMaps.DeregisterDynamicObjectWithUI(GetInstanceID());
 }
コード例 #7
0
 public void DeregisterWithUI()
 {
     registeredUIObj = UIMaps.DeregisterStaticObjectWithUI(registerKey);
 }
コード例 #8
0
        void AddWaypoint(float zOffset)
        {
            if (defaultWaypointRegisteredObj == null && currentWaypointRegisterObj == null)
            {
                // if (currentWaypointMarker != null) {

                // TODO: Get ground Y
                if (selectedMarker == null || UIMaps.RegisteredObjectIsPlayer(selectedMarker.uIRegisteredObject))
                {
                    Vector3 worldPos = Vector3.zero;
                    Vector2 wPos     = (move);// + Vector2.one * zOffset);// * mapSize;
                    Debug.LogError(wPos);


                    worldPos.x = mapCenter.x + wPos.x * mapRadius * 2;
                    worldPos.z = mapCenter.y + wPos.y * mapRadius * 2;
                    Debug.LogError(worldPos);

                    // register the default empty icon
                    defaultWaypointRegisteredObj = UIMaps.RegisterDynamicObjectWithUI(
                        "MapWaypoint", GetInstanceID(), worldPos, Vector3.forward, "Waypoint", null, null, null, null
                        );

                    defaultWaypointRegisteredObj.SetAsWaypoint(true);

                    defaultWaypointRegisteredObj.ShowMapType(UIMapsObject.ShowType.MainMap, true);
                    defaultWaypointRegisteredObj.ShowMapType(UIMapsObject.ShowType.MiniMap, true);
                    defaultWaypointRegisteredObj.ShowMapType(UIMapsObject.ShowType.Compass, true);
                    defaultWaypointRegisteredObj.ShowMapType(UIMapsObject.ShowType.ScreenMap, true);
                }
                else
                {
                    // Debug.Log("making waypoing already thtere");
                    currentWaypointRegisterObj = selectedMarker.uIRegisteredObject;

                    // worldPos = selectedMarker.GetMarkerPosition();
                    currentWaypointRegisterObj.SetAsWaypoint(true);

                    // alraedy showing map...
                    // currentWaypointMarker.uIRegisteredObject.ShowMainMap(true);

                    currentWaypointRegisterObj.ShowMapType(UIMapsObject.ShowType.MiniMap, true);
                    currentWaypointRegisterObj.ShowMapType(UIMapsObject.ShowType.Compass, true);
                    currentWaypointRegisterObj.ShowMapType(UIMapsObject.ShowType.ScreenMap, true);

                    // currentWaypointMarker = AddMapMarker ("MapWaypoint", GetInstanceID(), waypointIcon, () => worldPos, "Waypoint");
                }
            }
            else
            {
                if (currentWaypointRegisterObj != null)
                {
                    currentWaypointRegisterObj.SetAsWaypoint(false);

                    currentWaypointRegisterObj.ShowMapType(UIMapsObject.ShowType.ScreenMap, false);

                    if (!currentWaypointRegisterObj.loadedLocally)
                    {
                        currentWaypointRegisterObj.ShowMapType(UIMapsObject.ShowType.MiniMap, false);
                        currentWaypointRegisterObj.ShowMapType(UIMapsObject.ShowType.Compass, false);
                    }
                    currentWaypointRegisterObj = null;
                }
                // else {
                // }
                if (defaultWaypointRegisteredObj != null)
                {
                    defaultWaypointRegisteredObj = UIMaps.DeregisterDynamicObjectWithUI(GetInstanceID());
                }

                // currentWaypointMarker = null;
                // defaultWaypointRegisteredObj = null;



                // RemoveMapMarker(GetInstanceID());
                // currentWaypointMarker = null;
            }
        }