Example #1
0
 private void LoopGroupNode15_Next()
 {
     ActionNode14_behaviour = LoopGroupNode15_Item;
     // ActionNode
     // Visit uFrame.Actions.GameObjects.ActivateGameObject
     uFrame.Actions.GameObjects.ActivateGameObject(ActionNode14_gameObject, ActionNode14_behaviour);
 }
Example #2
0
 static public int CancelInvoke(IntPtr l)
 {
     try{
         if (matchType(l, 2))
         {
             UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l);
             self.CancelInvoke();
             return(0);
         }
         else if (matchType(l, 2, typeof(System.String)))
         {
             UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l);
             System.String             a1;
             checkType(l, 2, out a1);
             self.CancelInvoke(a1);
             return(0);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Example #3
0
 public void Initialize(MonoBehaviour parent)
 {
     foreach(Bullet.Action action in actions)
     {
         action.Initialize(parent);
     }
 }
        public static bool IsSupported(Shader s, bool needDepth, bool needHdr, MonoBehaviour effect)
        {
            if (s == null || !s.isSupported)
            {
                Debug.LogWarningFormat("Missing shader for image effect {0}", effect);
                return false;
            }

            if (!SystemInfo.supportsImageEffects || !SystemInfo.supportsRenderTextures)
            {
                Debug.LogWarningFormat("Image effects aren't supported on this device ({0})", effect);
                return false;
            }

            if (needDepth && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
            {
                Debug.LogWarningFormat("Depth textures aren't supported on this device ({0})", effect);
                return false;
            }

            if (needHdr && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf))
            {
                Debug.LogWarningFormat("Floating point textures aren't supported on this device ({0})", effect);
                return false;
            }

            return true;
        }
Example #5
0
        /// <summary>
        /// Create modal helper with the specified parent, sprite and color.
        /// </summary>
        /// <param name="parent">Parent.</param>
        /// <param name="sprite">Sprite.</param>
        /// <param name="color">Color.</param>
        /// <returns>Modal helper index</returns>
        public static int Open(MonoBehaviour parent, Sprite sprite = null, Color? color = null)
        {
            //проверить есть ли в кеше
            if (!Templates.Exists(key))
            {
                Templates.FindTemplates();
                CreateTemplate();
            }

            var modal = Templates.Instance(key);

            modal.transform.SetParent(Utilites.FindCanvas(parent.transform), false);
            modal.gameObject.SetActive(true);
            modal.transform.SetAsLastSibling();

            var rect = modal.GetComponent<RectTransform>();
            rect.sizeDelta = new Vector2(0, 0);
            rect.anchorMin = new Vector2(0, 0);
            rect.anchorMax = new Vector2(1, 1);
            rect.anchoredPosition = new Vector2(0, 0);

            var img = modal.GetComponent<Image>();
            if (sprite!=null)
            {
                img.sprite = sprite;
            }
            if (color!=null)
            {
                img.color = (Color)color;
            }

            used.Add(modal.GetInstanceID(), modal);
            return modal.GetInstanceID();
        }
Example #6
0
    /*******************************************************/

    /* !@brief      : リソースロード
     *  @param[in]  : path ->  リソースパス
     *  @param[in]  : type ->  リソースタイプ
     *  @retval     : Object
     *  @date       : 2014/05/02
     *  @author     : コロソブス(korombus)
     *******************************************************/
    public object Load(UnityEngine.MonoBehaviour MBeh, string path, System.Type type)
    {
        data = null;
        MBeh.StartCoroutine(create(MBeh, path, type));
        Debug.Log(data);
        return(data);
    }
Example #7
0
        public StepControl(MasterPlayer player, MonoBehaviour context)
        {
            m_player	= player;
            m_context	= context;

            m_context.StartCoroutine(UpdateCo());
        }
 public bool Preload(TextAsset asset, UnityEngine.MonoBehaviour mono,
                     Action <IConfigVoMap <K1> > onEnd, Action <float> onProcess)
 {
     if (asset == null || mono == null)
     {
         return(false);
     }
     if (m_Map == null)
     {
         m_Map = new Dictionary <K1, Dictionary <K2, V> >();
     }
     else
     {
         m_Map.Clear();
     }
     ConfigDictionary.PreloadWrap <K1, K2, V>(m_Map, asset, mono, out m_IsJson,
                                              (IDictionary maps) => {
         IConfigVoMap <K1> ret = maps != null ? this : null;
         if (onEnd != null)
         {
             onEnd(ret);
         }
     }, onProcess);
     return(true);
 }
Example #9
0
    public static Kind Of(GameObject entity, out NetEntityID entID, out UnityEngine.MonoBehaviour view)
    {
        if (entity == null)
        {
            entID = unassigned;
            view  = null;
            return(Kind.Missing);
        }
        uLink.NetworkView component = entity.GetComponent <uLink.NetworkView>();
        if (component != null)
        {
            entID = new NetEntityID(component.viewID);
            view  = component;
            return(Kind.Net);
        }
        NGCView view3 = entity.GetComponent <NGCView>();

        if (view3 != null)
        {
            entID = new NetEntityID(view3);
            view  = view3;
            return(Kind.NGC);
        }
        entID = unassigned;
        view  = null;
        return(Kind.Missing);
    }
 public bool Preload(byte[] buffer, UnityEngine.MonoBehaviour mono,
                     Action <IConfigVoMap <K> > onEnd, Action <float> onProcess)
 {
     if (buffer == null || mono == null)
     {
         return(false);
     }
     if (m_Map == null)
     {
         m_Map = new Dictionary <K, V>();
     }
     else
     {
         m_Map.Clear();
     }
     ConfigDictionary.PreloadWrap <K, V>(m_Map, buffer, mono, out m_IsJson,
                                         (IDictionary maps) => {
         IConfigVoMap <K> ret = maps != null ? this : null;
         if (onEnd != null)
         {
             onEnd(ret);
         }
     }, onProcess);
     return(true);
 }
		public void Play(MonoBehaviour owner, float delay, float time, 
			System.Action<float> whenUpdate, 
			System.Action<bool> whenFinish)
		{
			this.Play(owner, delay, time, false, iTweenSimple.LoopType.none, 
				whenUpdate, null, whenFinish);
		}
Example #12
0
    public static Kind Of(UnityEngine.MonoBehaviour script)
    {
        NetEntityID yid;

        UnityEngine.MonoBehaviour behaviour;
        return(Of(script, out yid, out behaviour));
    }
Example #13
0
        public static bool HasSameTagAs(this Collider source, MonoBehaviour self)
        {
            if (source == null || source.gameObject == null || source.gameObject.tag == null)
                return false;

            return source.gameObject.tag.Equals(self.gameObject.tag, StringComparison.OrdinalIgnoreCase);
        }
Example #14
0
 public bool Dequeue(UnityEngine.MonoBehaviour script, ulong playhead, out InterpTimedEvent node, ref InterpTimedEvent.LList.Iterator iter_)
 {
     if (this.count <= 0)
     {
         node = null;
         return(false);
     }
     InterpTimedEvent.Dir dir = (!iter_.started ? this.first : iter_.d);
     while (dir.has)
     {
         if ((double)((float)playhead) >= dir.node.info.timestamp)
         {
             if (dir.node.component == script)
             {
                 node          = dir.node;
                 iter_.d       = node.next;
                 iter_.started = true;
                 this.Remove(node);
                 return(true);
             }
             dir = dir.node.next;
         }
         else
         {
             break;
         }
     }
     iter_.d       = new InterpTimedEvent.Dir();
     iter_.started = true;
     node          = null;
     return(false);
 }
 public AutoNotificationManager(MonoBehaviour behaviour)
 {
     if (behaviour == null) throw new System.ArgumentNullException("behaviour");
     _behaviour = behaviour;
     _handlers = new Dictionary<System.Type, System.Delegate>();
     this.Init();
 }
 static public int IsInvoking(IntPtr l)
 {
     try{
         if (matchType(l, 2, typeof(string)))
         {
             UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l);
             System.String             a1;
             checkType(l, 2, out a1);
             System.Boolean ret = self.IsInvoking(a1);
             pushValue(l, ret);
             return(1);
         }
         else if (matchType(l, 2))
         {
             UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l);
             System.Boolean            ret  = self.IsInvoking();
             pushValue(l, ret);
             return(1);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
		/// <summary>
		/// just sets the x scale to -x
		/// </summary>
		/// <param name="component"></param>
		public static void FlipXScale(MonoBehaviour component)
		{
			RectTransform rectTransform = component.GetComponent<RectTransform>();
			Vector3 scale = rectTransform.localScale;
			scale.x *= -1f;
			rectTransform.localScale = scale;
		}
Example #18
0
 private void LoopGroupNode28_Next()
 {
     ActionNode30_behaviour = LoopGroupNode28_Item;
     // ActionNode
     // Visit uFrame.Actions.GameObjects.DeactiateGameObject
     uFrame.Actions.GameObjects.DeactiateGameObject(ActionNode30_gameObject, ActionNode30_behaviour);
 }
 public void DrawAudioFilterGUI(MonoBehaviour behaviour)
 {
   int filterChannelCount = AudioUtil.GetCustomFilterChannelCount(behaviour);
   if (filterChannelCount <= 0)
     return;
   if (this.dataOut == null)
     this.dataOut = new EditorGUI.VUMeter.SmoothingData[filterChannelCount];
   double num = (double) AudioUtil.GetCustomFilterProcessTime(behaviour) / 1000000.0;
   float r = (float) num / ((float) AudioSettings.outputSampleRate / 1024f / (float) filterChannelCount);
   GUILayout.BeginHorizontal();
   GUILayout.Space(13f);
   GUILayout.BeginVertical();
   EditorGUILayout.Space();
   for (int channel = 0; channel < filterChannelCount; ++channel)
     EditorGUILayout.VUMeterHorizontal(AudioUtil.GetCustomFilterMaxOut(behaviour, channel), ref this.dataOut[channel], GUILayout.MinWidth(50f), GUILayout.Height(5f));
   GUILayout.EndVertical();
   Color color = GUI.color;
   GUI.color = new Color(r, 1f - r, 0.0f, 1f);
   GUILayout.Box(string.Format("{0:00.00}ms", (object) num), new GUILayoutOption[2]
   {
     GUILayout.MinWidth(40f),
     GUILayout.Height(20f)
   });
   GUI.color = color;
   GUILayout.EndHorizontal();
   EditorGUILayout.Space();
   GUIView.current.Repaint();
 }
Example #20
0
 private void Awake()
 {
     Scene.ActiveMB = this;
     Scene.GameStats = this._gameStats;
     Scene.SceneTracker = this._sceneTracker;
     Scene.MutantControler = this._mutantControler;
     Scene.MutantSpawnManager = this._mutantSpawnManager;
     Scene.Yacht = this._yacht;
     Scene.PlaneCrash = this._plane;
     Scene.PlaneCrashAnimGO = this._planeCrashAnimGO;
     Scene.TriggerCutScene = this._triggerCutScene;
     Scene.RainFollowGO = this._rainFollowGO;
     Scene.RainTypes = this._rainTypes;
     Scene.WeatherSystem = this._weatherSystem;
     Scene.HudGui = this._hudGui;
     Scene.Cams = this._cams;
     Scene.Clock = this._clock;
     Scene.Atmosphere = this._atmos;
     Scene.WorkScheduler = this._workScheduler;
     Scene.LoadSave = this._loadSave;
     Scene.PlaneGreebles = this._planeGreebles;
     Scene.OceanFlat = this._oceanFlat;
     Scene.OceanCeto = this._oceanCeto;
     Scene.ShoreMask = this._shoreMask;
     Scene.SinkHoleCenter = this._sinkHoleCenter;
     Scene.CaveGrounds = this._caveGrounds;
 }
 static public int constructor(IntPtr l)
 {
     UnityEngine.MonoBehaviour o;
     o = new UnityEngine.MonoBehaviour();
     pushObject(l, o);
     return(1);
 }
Example #22
0
        bool ActivatePanelOnlyFor(UnityEngine.MonoBehaviour uiElement)
        {
            bool result = false;

            if (_Image)
            {
                bool act = _Image == uiElement;
                _ImagePanel.gameObject.SetActive(act);

                result = result || act;
            }
            if (TextComponent)
            {
                bool act = TextComponent == uiElement;
                _TextPanel.gameObject.SetActive(act);

                result = result || act;
            }
            if (_Toggle)
            {
                bool act = _Toggle == uiElement;
                _TogglePanel.gameObject.SetActive(act);

                result = result || act;
            }

            return(result);
        }
Example #23
0
 private void AddToActionList(List<SetEnabledOnDialogueEvent.SetEnabledAction> actions, MonoBehaviour component, Toggle state)
 {
     SetEnabledOnDialogueEvent.SetEnabledAction newAction = new SetEnabledOnDialogueEvent.SetEnabledAction();
     newAction.state = state;
     newAction.target = component;
     actions.Add(newAction);
 }
Example #24
0
    public static NetEntityID.Kind Of(UnityEngine.MonoBehaviour script)
    {
        NetEntityID netEntityID;

        UnityEngine.MonoBehaviour monoBehaviour;
        return(NetEntityID.Of(script, out netEntityID, out monoBehaviour));
    }
Example #25
0
    public static NetEntityID.Kind Of(GameObject entity, out NetEntityID entID, out UnityEngine.MonoBehaviour view)
    {
        if (!entity)
        {
            entID = NetEntityID.unassigned;
            view  = null;
            return(NetEntityID.Kind.Missing);
        }
        uLink.NetworkView component = entity.GetComponent <uLink.NetworkView>();
        if (component)
        {
            entID = new NetEntityID(component.viewID);
            view  = component;
            return(NetEntityID.Kind.Net);
        }
        NGCView nGCView = entity.GetComponent <NGCView>();

        if (nGCView)
        {
            entID = new NetEntityID(nGCView);
            view  = nGCView;
            return(NetEntityID.Kind.NGC | NetEntityID.Kind.Net);
        }
        entID = NetEntityID.unassigned;
        view  = null;
        return(NetEntityID.Kind.Missing);
    }
        public static IDisposable MarkCapturePhase(MonoBehaviour target)
        {
            Count++;
            return Observable.TimerFrame(AnimationSpeed * Count)
                .Subscribe(_ => target.GetComponent<Renderer>().material.color = Color.green);

        }
Example #27
0
        internal static IEnumerator Request(MonoBehaviour caller, EngageRequest request, EngageResponse response)
        {
            string requestJSON = request.ToJSON();
            string url = DDNA.Instance.ResolveEngageURL(requestJSON);

            HttpRequest httpRequest = new HttpRequest(url);
            httpRequest.HTTPMethod = HttpRequest.HTTPMethodType.POST;
            httpRequest.HTTPBody = requestJSON;
            httpRequest.TimeoutSeconds = DDNA.Instance.Settings.HttpRequestEngageTimeoutSeconds;
            httpRequest.setHeader("Content-Type", "application/json");

            System.Action<int, string, string> httpHandler = (statusCode, data, error) => {

                string engagementKey = "DDSDK_ENGAGEMENT_" + request.DecisionPoint + "_" + request.Flavour;
                if (error == null && statusCode >= 200 && statusCode < 300) {
                    try {
                        PlayerPrefs.SetString(engagementKey, data);
                    } catch (Exception exception) {
                        Logger.LogWarning("Unable to cache engagement: "+exception.Message);
                    }
                } else {
                    Logger.LogDebug("Engagement failed with "+statusCode+" "+error);
                    if (PlayerPrefs.HasKey(engagementKey)) {
                        Logger.LogDebug("Using cached response");
                        data = "{\"isCachedResponse\":true," + PlayerPrefs.GetString(engagementKey).Substring(1);
                    } else {
                        data = "{}";
                    }
                }

                response(data, statusCode, error);
            };

            yield return caller.StartCoroutine(Network.SendRequest(httpRequest, httpHandler));
        }
Example #28
0
 public bool Next()
 {
     if (_sequence.Count == 0)
         return false;
     _next = _sequence.Dequeue();
     return true;
 }
Example #29
0
        public void InitByBaseType(SerializedObject serializedObject, UnityEngine.MonoBehaviour target, string baseTypeFullName)
        {
            Init(serializedObject, target);

            allTypes = Help.GetBaseType(baseTypeFullName);
            allTypes.Insert(0, null);
        }
        // 因为List<T>里获得T类型有一个数组分配所以建议游戏运行时,不要用这个函数
        // 只用在测试中
        public static Dictionary <K, V> TestToWrap <K, V>(byte[] buffer,
                                                          out bool isJson, bool isLoadAll          = false,
                                                          UnityEngine.MonoBehaviour loadAllCortine = null) where V : class, new()
        {
            isJson = false;
            if (buffer == null || buffer.Length <= 0)
            {
                return(null);
            }

            Dictionary <K, V> ret = ConfigWrap.TestCommonToObject <K, V>(buffer, isLoadAll, loadAllCortine);

            if (ret == null)
            {
                try {
                    string text = System.Text.Encoding.UTF8.GetString(buffer);
                    ret    = JsonMapper.ToObject <Dictionary <K, V> >(text);
                    isJson = true;
                } catch {
                    ret = null;
                }
            }

            return(ret);
        }
		public static void MoveAlignmentFromRightToLeft(MonoBehaviour component)
		{
			RectTransform rectTransform = component.GetComponent<RectTransform>();
			rectTransform.anchorMin = new Vector2(0f, 1f);
			rectTransform.anchorMax = new Vector2(0f, 1f);
			rectTransform.anchoredPosition = new Vector2(-rectTransform.anchoredPosition.x + rectTransform.rect.width, rectTransform.anchoredPosition.y);
		}
        /// <summary>
        /// This is called every time we swap back to this
        /// i.e. this will be re-entered while it's still active
        /// </summary>
        public void OnEnable()
        {
            Debug.Log("EventSwitchboardViewer enabled");
            if (target != null)
            {
                RearJackObject = Switchboard.Target;

                if (RearJackObject != null)
                {
                    InitialiseTargetSelectionModules(RearJackObject);
                }
            }

            if (reorderableList == null)
            {
                reorderableList
                    = new ReorderableList(
                          Switchboard.CordCircuits,
                          typeof(CordCircuit),
                          true, true, true, true
                          );
                reorderableList.serializedProperty
                    = serializedObject.FindProperty("CordCircuits");
            }

            reorderableList.drawHeaderCallback    += DrawCordCircuitListHeader;
            reorderableList.drawElementCallback   += ReorderableListRenderCircuitEntry;
            reorderableList.onAddCallback         += ReorderableListAddCordCircuit;
            reorderableList.onRemoveCallback      += ReorderableListDeleteCircuit;
            reorderableList.elementHeightCallback += ReorderableListCalculateElementHeight;
        }
Example #33
0
 static public int IsInvoking(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l);
             var ret = self.IsInvoking();
             pushValue(l, ret);
             return(1);
         }
         else if (argc == 2)
         {
             UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l);
             System.String             a1;
             checkType(l, 2, out a1);
             var ret = self.IsInvoking(a1);
             pushValue(l, ret);
             return(1);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Example #34
0
		// PRIVATE STATIC
		
		//--------------------------------------
		//  Methods
		//--------------------------------------	
		// PUBLIC
		
		///<summary>
		///	 Constructor
		///</summary>
		public FirstState (MonoBehaviour aTarget_monobehavior)
		{
			//
			//Debug.Log ("FirstState.constructor()");
			_target_monobehavior = aTarget_monobehavior;
			
		}
 public HollywoodMVCSContext(MonoBehaviour view) : base(view, ContextStartupFlags.MANUAL_MAPPING)
 {
     _hollywoodContextView = view.GetComponent<IHollywoodContextView>();
     if (_hollywoodContextView == null)
         throw (new Exception("HollywoodMVCSContext constructor error, there's no IHollywoodContextView instance on context's view !!!"));
     Start();
 }
		public override void Reset() {
			
			base.Reset();
			
			this.tempResource = null;
			
		}
Example #37
0
        public void InitByAttribute(SerializedObject serializedObject, UnityEngine.MonoBehaviour target, System.Type attributeType)
        {
            Init(serializedObject, target);

            allTypes = Help.GetCustomAttributesType(attributeType);
            allTypes.Insert(0, null);
        }
 /// <summary>
 /// Set up a revert info for a static object.
 /// </summary>
 /// <param name="monoBehaviour">The MonoBehaviour that is making this RevertInfo.</param>
 /// <param name="type">The type of the static object</param>
 /// <param name="memberName">The member name of the field/property/method to be called on revert.</param>
 /// <param name="value">The current value you want to save.</param>
 public RevertInfo(MonoBehaviour monoBehaviour, Type type, string memberName, object value)
 {
     this.MonoBehaviour = monoBehaviour;
     this.Type = type;
     this.value = value;
     this.MemberInfo = Type.GetMember(memberName);
 }
 static public int StopCoroutine(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 2, typeof(UnityEngine.Coroutine)))
         {
             UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l);
             UnityEngine.Coroutine     a1;
             checkType(l, 2, out a1);
             self.StopCoroutine(a1);
             return(0);
         }
         else if (matchType(l, argc, 2, typeof(System.Collections.IEnumerator)))
         {
             UnityEngine.MonoBehaviour      self = (UnityEngine.MonoBehaviour)checkSelf(l);
             System.Collections.IEnumerator a1;
             checkType(l, 2, out a1);
             self.StopCoroutine(a1);
             return(0);
         }
         else if (matchType(l, argc, 2, typeof(string)))
         {
             UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l);
             System.String             a1;
             checkType(l, 2, out a1);
             self.StopCoroutine(a1);
             return(0);
         }
         return(error(l, "No matched override function to call"));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 /// <summary>
 /// Check for a usable tango application component in the scene. Draw warning if 
 /// one could not be found.
 /// 
 /// Should be called first before using any other TangoPrefabInspectorHelper function
 /// during a given frame, to determine if a valid TangoApplication reference exists
 /// with which to call other TangoPrefabInspectorHelper methods.
 /// </summary>
 /// <returns><c>true</c>, if a tango application on an active GameObject can be identified, 
 /// <c>false</c> otherwise.</returns>
 /// <param name="inspectedBehaviour">Prefab behavior that's being inspected.</param>
 /// <param name="tangoApplication">Prefab inspector's reference to Tango Application, or
 /// null if no Tango Application on an active GameObject can be identified.</param>
 public static bool CheckForTangoApplication(MonoBehaviour inspectedBehaviour,
                                             ref TangoApplication tangoApplication)
 {
     if (tangoApplication == null || !tangoApplication.gameObject.activeInHierarchy)
     {
         tangoApplication = GameObject.FindObjectOfType<TangoApplication>();
     }
     
     // Note: .isActiveAndEnabled is the appropriate thing to check here because all Register() 
     // calls on existing Tango prefabs are called in Start(), which won't occur until both the
     // behaviour is enabled and the game object it is attached to is active.
     // 
     // Conversely, if any of the tango prefabs called Register() in Awake(), the correct thing
     // to check against would be .gameObject.activeInHeirarchy, since Awake is called when the
     // game object it is attached to is active, regardless of whether the behaviour itself is
     // enabled.
     if (tangoApplication == null && inspectedBehaviour.isActiveAndEnabled)
     {
         EditorGUILayout.HelpBox("Could not find an active TangoApplication component in the scene.\n\n"
                                 + "Component will not function correctly if it cannot find "
                                 + "an active TangoApplication component at runtime.",
                                 MessageType.Warning);
         return false;
     }
     
     return tangoApplication != null;
 }
 static public int CancelInvoke(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l);
             self.CancelInvoke();
             pushValue(l, true);
             return(1);
         }
         else if (argc == 2)
         {
             UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l);
             System.String             a1;
             checkType(l, 2, out a1);
             self.CancelInvoke(a1);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        private void ProcessBehaviour(MonoBehaviour behaviour)
        {
            Type componentType = behaviour.GetType();
            ClassDataHolder data = ReflectionDataCache.GetClassData(componentType);

            for (int i = 0; i < data.PropertyInfos.Length; i++)
            {
                PropertyInfo property = data.PropertyInfos[i];
                if (data.PropertyAttributes[i]) continue;
                ThrowIfNotNull(property.GetValue(behaviour, null));

                object dependency = _context.Resolve(property.PropertyType);
                property.SetValue(behaviour, dependency, null);
            }

            for (int i = 0; i < data.FieldInfos.Length; i++)
            {
                FieldInfo field = data.FieldInfos[i];
                if (data.FieldAttributes[i]) continue;
                ThrowIfNotNull(field.GetValue(behaviour));

                object dependency = _context.Resolve(field.FieldType);
                field.SetValue(behaviour, dependency);
            }
        }
Example #43
0
 public bool Dequeue(UnityEngine.MonoBehaviour script, ulong playhead, out InterpTimedEvent node, ref Iterator iter_)
 {
     if (this.count <= 0)
     {
         node = null;
         return(false);
     }
     for (InterpTimedEvent.Dir dir = !iter_.started ? this.first : iter_.d; dir.has; dir = dir.node.next)
     {
         if (playhead < dir.node.info.timestamp)
         {
             break;
         }
         if (dir.node.component == script)
         {
             node          = dir.node;
             iter_.d       = node.next;
             iter_.started = true;
             this.Remove(node);
             return(true);
         }
     }
     iter_.d       = new InterpTimedEvent.Dir();
     iter_.started = true;
     node          = null;
     return(false);
 }
Example #44
0
 public void DrawAudioFilterGUI(MonoBehaviour behaviour)
 {
     int customFilterChannelCount = AudioUtil.GetCustomFilterChannelCount(behaviour);
     if (customFilterChannelCount > 0)
     {
         if (this.dataOut == null)
         {
             this.dataOut = new EditorGUI.VUMeter.SmoothingData[customFilterChannelCount];
         }
         double num2 = ((double) AudioUtil.GetCustomFilterProcessTime(behaviour)) / 1000000.0;
         float r = ((float) num2) / ((((float) AudioSettings.outputSampleRate) / 1024f) / ((float) customFilterChannelCount));
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         GUILayout.Space(13f);
         GUILayout.BeginVertical(new GUILayoutOption[0]);
         EditorGUILayout.Space();
         for (int i = 0; i < customFilterChannelCount; i++)
         {
             GUILayoutOption[] optionArray1 = new GUILayoutOption[] { GUILayout.MinWidth(50f), GUILayout.Height(5f) };
             EditorGUILayout.VUMeterHorizontal(AudioUtil.GetCustomFilterMaxOut(behaviour, i), ref this.dataOut[i], optionArray1);
         }
         GUILayout.EndVertical();
         Color color = GUI.color;
         GUI.color = new Color(r, 1f - r, 0f, 1f);
         GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(40f), GUILayout.Height(20f) };
         GUILayout.Box(string.Format("{0:00.00}ms", num2), options);
         GUI.color = color;
         GUILayout.EndHorizontal();
         EditorGUILayout.Space();
         GUIView.current.Repaint();
     }
 }
Example #45
0
        /// <summary>
        /// Logs a session and returns session information on success.
        /// </summary>
        public static void LogSession(MonoBehaviour mb, ClientArgs args, Guid userId, string detail, string revisionId, Action<Guid, string> onSuccess, Action<string> onFailure)
        {
            var data = new Dictionary<string, object>();
            data.Add("user_id", userId);
            data.Add("release_id", args.ReleaseId);
            // XXX (kasiu): Need to check if this is the right DateTime string to send. I THINK THIS IS WRONG BUT I DON'T GIVE A FOOBAR RIGHT NOW. FIXME WHEN THE SERVER SCREAMS.
            data.Add("client_time", DateTime.Now.ToString());
            data.Add("detail", detail);
            data.Add("library_revid", revisionId);

            // Processing to get session_id
            Action<string> callback = s => {
                var s2 = s.Replace("{", "").Replace("}", "").Replace("\"", "").Trim();
                var split = s2.Split(',');
                if (split.Length != 2) {
                    onFailure(string.Format("LogSession received ill-formatted JSON: {0}", s));
                }
                var sessionId = split[0].Split(':')[1].Trim();
                var sessionKey = split[1].Split(':')[1].Trim();

                onSuccess(new Guid(sessionId), sessionKey);
            };

            var newArgs = new ClientArgs(new Uri(args.BaseUri, "/api/session"), args);
            SendNonSessionRequest(mb, newArgs, data, callback, onFailure);
        }
 public StrikingState(MonoBehaviour parent)
     : base(parent)
 {
     gameController = (PoolGameController)parent;
     cue = gameController.cue;
     cueBall = gameController.cueBall;
 }
Example #47
0
		void Awake() {
			if (fpController == null) fpController = GetComponentInChildren<vp_FPController>();
			if (fpCamera == null) fpCamera = GetComponentInChildren<vp_FPCamera>();
			if (fpPlayerEventHandler == null) fpPlayerEventHandler = GetComponentInChildren<vp_FPPlayerEventHandler>();
			if (fpInput == null) fpInput = GetComponentInChildren<vp_FPInput>();
			if (fpHUD == null) fpHUD = GetComponentInChildren<vp_SimpleHUD>();
			if (fpCrosshair == null) fpCrosshair = GetComponentInChildren<vp_SimpleCrosshair>();
		}
Example #48
0
 public LevelRestarter(MonoBehaviour coroutineRunner,
                       ScoreDisplayBehaviour scoreDisplayBehaviour,
                       FullscreenScoreDisplayBehaviour fullscreenScoreDisplayBehaviour)
 {
     _coroutineRunner = coroutineRunner;
     _scoreDisplayBehaviour = scoreDisplayBehaviour;
     _fullscreenScoreDisplayBehaviour = fullscreenScoreDisplayBehaviour;
 }
Example #49
0
		private void Start()
		{
			if (SCANmechjebMainMenu.Loaded)
			{
				print("[SCANsatMechJeb] Starting SCANsat - MechJeb Interface...");
				SCANmechjebInt = gameObject.AddComponent<SCANmechjeb>();
			}
		}
Example #50
0
 public void ExitStateByOwner(UnityEngine.MonoBehaviour Owner)
 {
     if (StateHash.ContainsKey(Owner))
     {
         PersistState state = StateHash[Owner];
         ExitState(state);
     }
 }
Example #51
0
		public static void LogFullInfo(string varname,MonoBehaviour mono ,object exter = null)
		{
			DateTime currentTime = DateTime.Now;
			if(exter == null)
				LogMgr.Log( currentTime.ToString() +" || varname:" +varname +" || " + mono +" Enble:"+mono.enabled.ToString() +" || active :"+ mono.gameObject.activeSelf.ToString());
			else
				LogMgr.Log( currentTime.ToString() +" || varname:" +varname +" || " + mono +" Enble:"+mono.enabled.ToString() +" || active :"+ mono.gameObject.activeSelf.ToString() +" || "+ exter.ToString());
		}
 public AsyncStoper(UnityEngine.MonoBehaviour main, TimeSpan maxTime, EventHandler <EventArgs> @event = null, bool autoReset = false, bool ignoreTimeScale = false)
 {
     _Main           = main;
     MaxTime         = maxTime;
     AutoReset       = autoReset;
     IgnoreTimeScale = ignoreTimeScale;
     OnEnd          += @event;
 }
 /// <summary>
 /// Set up Revert Info for an instance object.
 /// </summary>
 /// <param name="monoBehaviour">The MonoBehaviour that is making this RevertInfo.</param>
 /// <param name="obj">The instance of the object you want to save.</param>
 /// <param name="memberName">The member name of the field/property/method to be called on revert.</param>
 /// <param name="value">The current value you want to save.</param>
 public RevertInfo(MonoBehaviour monoBehaviour, object obj, string memberName, object value)
 {
     this.MonoBehaviour = monoBehaviour;
     this.Instance = obj;
     this.Type = obj.GetType();
     this.value = value;
     this.MemberInfo = Type.GetMember(memberName);
 }
Example #54
0
 public static void RecordObject(MonoBehaviour component, string msg)
 {
     #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2
     Undo.RegisterUndo(component, msg);
     #else
     Undo.RecordObject(component, msg);
     #endif
 }
Example #55
0
    /*******************************************************/

    /* !@brief      : プレハブからオブジェクトをインスタンス
     *  @param[in]  : path      ->  リソースパス
     *  @param[in]  : type      ->  リソースタイプ
     *  @param[in]  : parent    ->  親オブジェクトのTransform
     *  @retval     : Object
     *  @date       : 2014/05/02
     *  @author     : コロソブス(korombus)
     *******************************************************/
    public GameObject PrefabInstanceObj(UnityEngine.MonoBehaviour MBeh, string path, Transform parent, string objName)
    {
        MBeh.StartCoroutine(create(MBeh, path, typeof(GameObject), parent));
        GameObject obj = data as GameObject;

        obj.name = objName;
        return(obj);
    }
    static public int set_useGUILayout(IntPtr l)
    {
        UnityEngine.MonoBehaviour o = (UnityEngine.MonoBehaviour)checkSelf(l);
        bool v;

        checkType(l, 2, out v);
        o.useGUILayout = v;
        return(0);
    }
Example #57
0
 public static GameObject CreateObject(this UnityEngine.MonoBehaviour load, GameObject obj, Transform parent = null)
 {
     if (Object.Instantiate(obj) is GameObject go)
     {
         parent?.AddChild(go.transform);
         return(go);
     }
     return(null);
 }
Example #58
0
 protected override void OnWillRemoveAddon()
 {
     if (singleton == this)
     {
         singleton = null;
     }
     this.hasHighlight     = false;
     this.lastUseHighlight = null;
 }
Example #59
0
 private static bool GetMB(UnityEngine.MonoBehaviour networkView, out Contextual contextual)
 {
     if ((networkView != null) && ((contextual = networkView.GetComponent <Contextual>()) != null))
     {
         return(contextual.exists);
     }
     contextual = null;
     return(false);
 }
 public static int  obj_hash(long nIntPtr)
 {
     UnityEngine.MonoBehaviour obj = FCGetObj.GetObj <UnityEngine.MonoBehaviour>(nIntPtr);
     if (obj != null)
     {
         return(obj.GetHashCode());
     }
     return(0);
 }