static void Main(string[] args) { ApplicationContext.Default.Scan("jucardi.inject.test"); SomeComponent component = ApplicationContext.Default.Resolve <SomeComponent>(); SomeComponent2 component2 = ApplicationContext.Default.Resolve <SomeComponent2>(); Console.WriteLine("Hello World!"); }
public override void OnInspectorGUI() { SomeComponent obj = target as SomeComponent; Section4(); if (!foldout[3]) { DrawDefaultInspector(); Separator(); Custom(); } Separator(); foldout[3] = EditorGUILayout.Foldout(foldout[3], "Section 4"); }
public void SumCorrect() { var yearProviderMock = Substitute.For <IProvideYear>(); var currentYear = 2016; var x = 123; var y = 456; yearProviderMock.GetYear().Returns(currentYear); var sut = new SomeComponent(yearProviderMock); var expected = currentYear + x + y; var actual = sut.DoSomething(x, y); Assert.AreEqual(expected, actual); }
// Start is called before the first frame update void Start() { // works in all builds var obj1 = Resources.Load("myPrefab"); Debug.Log(obj1); // prints "myPrefab (UnityEngine.GameObject)" // works in all builds GameObject obj2 = Resources.Load <GameObject>("myPrefab"); Debug.Log(obj2); // prints "myPrefab (UnityEngine.GameObject)" // Works if built locally but fails if built by Unity Cloud for iOS SomeComponent exampleBehavior123 = Resources.Load <SomeComponent>("myPrefab"); // Unity Editor and local iOS build prints "myPrefab (SomeComponent)" // Unity Cloud iOS build prints "null" Debug.Log(exampleBehavior123); }
public override void OnInspectorGUI() { SomeComponent someComponent = target as SomeComponent; if (someComponent.myScriptable == null) { someComponent.myScriptable = CreateInstance <MyScriptable>(); } SerializedProperty myScriptableProp = serializedObject.FindProperty("myScriptable"); EditorGUILayout.PropertyField(myScriptableProp); SerializedObject child = new SerializedObject(myScriptableProp.objectReferenceValue); SerializedProperty myChildValueProp = child.FindProperty("myChildValue"); EditorGUILayout.PropertyField(myChildValueProp); child.ApplyModifiedProperties(); }
void Section2() { SomeComponent obj = target as SomeComponent; EditorGUILayout.BeginHorizontal(); overdraw = EditorGUILayout.Toggle("Overdraw?", overdraw); if (overdraw) { GUI.color = Color.red; } if (GUILayout.Button(new GUIContent(overdraw ? xIcon : checkIcon), WH(100))) { overdraw = !overdraw; } GUI.color = clr; EditorGUILayout.EndVertical(); if (overdraw) { Graphics.DrawTexture(new Rect(axisX, axisY, 256, 256), obj.someSprite.texture); } }
void Section1() { SomeComponent obj = target as SomeComponent; coloredAlignedText.normal.textColor = obj.someColor; EditorGUILayout.LabelField("Some text on right alligment", coloredAlignedText); Texture2D tex = AssetPreview.GetAssetPreview(obj.someSprite); EditorGUILayout.BeginHorizontal(); obj.someSprite = EditorGUILayout.ObjectField( obj.someSprite, typeof(Sprite), false, WH(100) ) as Sprite; GUI.color = obj.someColor; EditorGUILayout.LabelField(new GUIContent(xIcon), WH(100)); GUI.color = clr; EditorGUILayout.LabelField(new GUIContent(tex), WH(100)); EditorGUILayout.EndHorizontal(); }
/// <summary> /// Syncs property values by copying from working fields to reference fields. /// </summary> public override void Sync() { try { //__SomeComponent = ObjectHelper.Clone<MVCSettingsComponent>(_SomeComponent); SomeComponent.Sync(); __SomeInt = _SomeInt; __SomeBoolean = _SomeBoolean; __SomeString = _SomeString; base.Sync(); if (Dirty) { throw new ApplicationException("Sync failed."); } } catch (Exception ex) { Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error); throw; } }
public SomeRightImplementation(SomeComponent someComponent) { SomeComponent = someComponent; }
public async Task SetStreamBoundsAsync(double latitude, double longitude) { // Do something with Twitter here maybe? await SomeComponent.SetStreamBoundsAsync(latitude, longitude); }