예제 #1
0
        void DrawDeregisterWithMapObject()
        {
            if (GUILayout.Button("Deregister With Static Object Registry"))
            {
                if (string.IsNullOrEmpty(uiObj.staticMapObjectRegisterName))
                {
                    Debug.LogError("Need a static map object registry to deregister with");
                    return;
                }
                StaticMapsObjectRegistry mapObjRegister = GameSettings.GetSettings <StaticMapsObjectRegistry>(uiObj.staticMapObjectRegisterName);
                if (mapObjRegister == null)
                {
                    return;
                }


                int registerKey = uiObj.registerKey;

                for (int i = 0; i < mapObjRegister.staticObjects.Count; i++)
                {
                    if (mapObjRegister.staticObjects[i].key == registerKey)
                    {
                        mapObjRegister.staticObjects.Remove(mapObjRegister.staticObjects[i]);
                        return;
                    }
                }
            }
        }
예제 #2
0
        void DrawRegisterWithMapObject()
        {
            if (GUILayout.Button("Register/Update With Static Object Registry"))
            {
                if (string.IsNullOrEmpty(uiObj.staticMapObjectRegisterName))
                {
                    Debug.LogError("Need a static map object registry to register with");
                    return;
                }
                StaticMapsObjectRegistry mapObjRegister = GameSettings.GetSettings <StaticMapsObjectRegistry>(uiObj.staticMapObjectRegisterName);
                if (mapObjRegister == null)
                {
                    return;
                }

                UIMapsObject obj = GetRegisteredObjectOnStaticRegister(mapObjRegister);

                obj.InitializeWithValues(uiObj.transform.position, uiObj.transform.forward, uiObj.message, uiObj.miniMapIconName, uiObj.mainMapIconName, uiObj.compassIconName, uiObj.worldViewIconName);
            }
        }
예제 #3
0
        UIMapsObject GetRegisteredObjectOnStaticRegister(StaticMapsObjectRegistry mapObjRegister)
        {
            int registerKey = uiObj.registerKey;

            for (int i = 0; i < mapObjRegister.staticObjects.Count; i++)
            {
                if (mapObjRegister.staticObjects[i].key == registerKey)
                {
                    return(mapObjRegister.staticObjects[i]);
                }
            }

            Debug.Log("static object '" + uiObj.gameObject.name + " is not registered with register group '" + mapObjRegister.name + "', adding it...");
            UIMapsObject neRegisteredObj = new UIMapsObject(uiObj.transform.position, uiObj.transform.forward, uiObj.message, uiObj.miniMapIconName, uiObj.mainMapIconName, uiObj.compassIconName, uiObj.worldViewIconName, false);

            neRegisteredObj.key = registerKey;
            mapObjRegister.staticObjects.Add(neRegisteredObj);
            EditorUtility.SetDirty(mapObjRegister);
            return(neRegisteredObj);
        }