public void StartUnlimitedBullet(float time) { m_unlimitedBulletRemainTime = time; m_unlimitedBulletStartTime = time; isUnlimitedBullet = true; XLogger.Log("Magazine Start UnlimitedBullet"); }
public static T CopyComponent <T>(T original, GameObject destination, BindingFlags bindingFlags = DECLARED_ONLY) where T : Component { Type type = original.GetType(); Component copy = destination.AddComponent(type); FieldInfo[] fields = type.GetFields(); PropertyInfo[] properties = type.GetProperties(bindingFlags); foreach (FieldInfo field in fields) { field.SetValue(copy, field.GetValue(original)); } foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanRead) { if (propertyInfo.CanWrite) { try { var propertyValue = propertyInfo.GetValue(original, null); propertyInfo.SetValue(copy, propertyValue, null); } catch (Exception e) { XLogger.Log(e); throw; } } } } return(copy as T); }
/// <summary> /// Inputのインターフェースを作成 /// </summary> /// <param name="id">ユーザーID</param> /// <param name="type">入力のタイプ</param> /// <returns>作成成功か?</returns> public static bool CreateInterface(UserID id, XVInputType type) { int i = (int)id; switch (type) { case XVInputType.None: XLogger.LogWarning("Create interface= XVInputNone: id= " + i.ToString()); m_input[i] = new XVInputNone(); break; case XVInputType.Keyboard: XLogger.Log("Create interface= XVInputKeyboard: id= " + i.ToString()); m_input[i] = new XVInputKeyboard(); break; case XVInputType.Controller: #if DEBUG if (XVInput.GetConnectedNum() == 0) { if (id == UserID.User1) { m_input[i] = new XVInputKeyboard(); XLogger.LogWarning("Debug Create interface= XVInputKeyboard: id= " + i.ToString()); return(true); } } #endif XLogger.Log("Create interface= XVInputController: id= " + i.ToString()); m_input[i] = new XVInputController(id); break; } return(true); }
public void OnChangePath(){ var assetPath = SelectionUtils.GetAssetFolder( Selection.objects[0] ); var path = EditorUtility.SaveFilePanel("Save Animation File", assetPath, Selection.activeObject.name , "anim"); XLogger.Log("path : " + path); XLogger.Log("path : " + path); }
public static void CreateSelection(){ if(Selection.objects == null || Selection.objects.Length == 0) { XLogger.Log("Selection objects must greater one!!"); return; } List<Sprite> sprites = new List<Sprite>(); List<Texture2D> textures = SelectionUtils.GetObjects<Texture2D>(); List<Sprite> tex2Sprite = XUtils.ToList<Texture2D, Sprite>(textures, (v)=>{ var objects = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GetAssetPath(v)); for (int i = 0; i < objects.Length; i++) { var o = objects[i]; if(o is Sprite){ return o as Sprite; } } return null; }); sprites = tex2Sprite; tex2Sprite.AddRange(SelectionUtils.GetObjects<Sprite>()); if(sprites.Count == 0) { XLogger.Log("Selection sprites must greater one!!"); return; } var creator = InitWindow<SpriteAnimationCreator>(); creator.totalSprite = sprites; creator.InitPath(); }
public override void OnXGUI() { //TODO List if (dbFile == null) { Close(); } if (dbFile != null) { if (dbConnection == null) { string appDBPath = AssetDatabase.GetAssetPath(dbFile); try { dbConnection = new SqliteConnection("URI=file:" + appDBPath); dbConnection.Open(); } catch (Exception e) { XLogger.Log(e.Message); } currTable = ""; GetAllTableName(); } else { ReadAllTable(); } } }
public override void OnXGUI() { if (null != codeObject) { DoButton <XCodeObject>("SaveTemplate", SaveTemplete, codeObject); DoButton("Clean", () => codeObject = null); DoButton("Compile", Compile); DoButton("Help MemberAttributes", () => { for (int i = 0; i <= 61440; i++) { XLogger.Log(Enum.ToObject(typeof(MemberAttributes), i).ToString()); } }); codeObject.Draw(this); } else { if (CreateSpaceButton("Create")) { GenerateNewCode(); } DoButton("OpenTemplate", () => codeObject = OpenTemplate()); } }
public void ForceStopReload() { isReloading = false; m_reloadRemainTime = 0.0f; m_callbackReloaded.Invoke(); XLogger.Log("Magazine ForceStop Reload"); }
public static object GetField(object target, System.Type type, string fieldName) { PropertyInfo property = type.GetProperty(fieldName); FieldInfo field = type.GetField(fieldName); if (null == property && null == field) { XLogger.Log(type.Name + "." + " not contain " + fieldName); return(null); } object returnValue = null; if (null != property) { returnValue = property.GetValue(target, null); } else if (null != field) { returnValue = field.GetValue(target); } if (null == returnValue) { XLogger.Log(type.Name + "." + property.Name + " is null."); return(null); } return(returnValue); }
private static MethodInfo TryGetGlobalMethodInfo(this Type target, string methodName) { XLogger.Log (string.Format("target is null{0}", target == null)); var methodInfo = target.GetMethod( methodName, STATIC_FLAGS ); XLogger.Log (string.Format("method is null, {0}", methodInfo == null)); return methodInfo; }
public static T SelectableString <T>(T defaultContent, T[] array, Action <T> onChange, params GUILayoutOption[] option) where T : class { string[] content = new string[array.Length]; for (int i = 0; i < array.Length; i++) { content[i] = array[i].ToString(); } int selectedIndex = -1; for (int i = 0; i < array.Length; i++) { if (defaultContent == array[i]) { selectedIndex = i; } } if (selectedIndex == -1) { XLogger.Log(defaultContent.ToString()); return(default(T)); } var index = EditorGUILayout.Popup(selectedIndex, content, option); return(array[index]); }
protected virtual void Awake() { if (mInstance != null && mInstance != this) { XLogger.Log("Found Singleton : " + mInstance.name); Destroy(gameObject); return; } else { if (mInstance == null) { mInstance = this as T; } if (isDontDestroy) { DontDestroyOnLoad(gameObject); } gameObject.hideFlags = gameObjectFlags; OnAwake(); } }
public void ShowAllIcon() { foreach (MouseCursor item in Enum.GetValues(typeof(MouseCursor))) { DoButton(Enum.GetName(typeof(MouseCursor), item), () => XLogger.Log(item.ToString())); EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), item); GUILayout.Space(10); } //for( int i = 0; i < XResources.GetInstance().IconNames.Length; i += 8 ) //{ // GUILayout.BeginHorizontal(); // for( int j = 0; j < 8; j++ ) // { // int index = i + j; // if( index < XResources.GetInstance().IconNames.Length ) // { // string btnName = XResources.GetInstance().IconNames[index]; // GUIContent content = EditorGUIUtility.IconContent( btnName ); // AddButton( content, () => Logger.Log( btnName.ToString() ), GUILayout.Width( 50 ), GUILayout.Height( 30 ) ); // } // } // GUILayout.EndHorizontal(); //} }
void OnEnable() { isInit = true; XLogger.Log("Discovery Enable"); Address.Clear(); Initialize(); this.StartAsClient(); }
protected virtual void OnDestroy() { if (mInstance == this) { mInstance = null; } XLogger.Log(name + " OnDestroy"); }
public void ShowAllIcon() { foreach (MouseCursor item in Enum.GetValues(typeof(MouseCursor))) { DoButton(Enum.GetName(typeof(MouseCursor), item), () => XLogger.Log(item.ToString())); EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), item); } }
internal static void ToggleComponent() { showHideComponents = EditorPrefs.GetBool(PrefKeyShowHideComponent); showHideComponents = !showHideComponents; EditorPrefs.SetBool(PrefKeyShowHideComponent, showHideComponents); XLogger.Log("ToggleComponent was " + (showHideComponents ? "Close" : "Open")); EditorApplication.RepaintHierarchyWindow(); }
internal static void Toggle() { bool toggle = EditorPrefs.GetBool(PrefKeyShowToggle); ShowQuickToggle(!toggle); XLogger.Log("Toggle was " + (toggle ? "Close" : "Open")); EditorApplication.RepaintHierarchyWindow(); }
static void SetPath() { var folder = EditorUtility.OpenFolderPanel("Path", projectPath, "WuxingogoExtension"); XLogger.Log(folder); projectPath = folder; XResources.InitTexture(); }
public static void GetInfo() { var o = GetObject <Object>(); XLogger.Log("name:" + o.name); XLogger.Log("Type:" + o.GetType()); XLogger.Log("InstanceID:" + o.GetInstanceID()); }
public void StartReload(UnityAction callback) { m_callbackReloaded.RemoveAllListeners(); isReloading = true; m_reloadRemainTime = m_reloadTime; m_callbackReloaded.AddListener(callback); XLogger.Log("Magazine Reload"); }
// called when the 'using' block ends public void Dispose() { m_watch.Stop(); float ms = m_watch.ElapsedMilliseconds; XLogger.Log(string.Format("{0} finished: {1:0.00}ms total," + " {2:0.000000}ms per test for {3} tests", m_timerName, ms, ms / m_numTests, m_numTests)); }
public static object CallMethod(object target, System.Type type, string methodCMD) { string method_str = ""; string parasCMD = ""; object[] paras = null; method_str = methodCMD.Substring(0, methodCMD.IndexOf("(")); parasCMD = methodCMD.Substring(methodCMD.IndexOf("("), methodCMD.Length - methodCMD.IndexOf("(")); parasCMD = parasCMD.Substring(1, parasCMD.Length - 2); if (!parasCMD.Equals("")) { if (parasCMD.Contains(",")) { string[] strParas = parasCMD.Split(','); paras = new object[strParas.Length]; for (int pos = 0; pos < strParas.Length; pos++) { // TODO loop in strParas // paras[pos] = int.Parse( strParas[pos] ); // if(strParas[pos].Contains("\"")){ // paras.SetValue(parasCMD.Replace("\"",""),pos); // } // // else // paras.SetValue(int.Parse(strParas[pos]),pos); paras.SetValue(GetParaFromString(strParas[pos]), pos); } } else { paras = new object[1]; paras.SetValue(GetParaFromString(parasCMD), 0); // if(parasCMD.Contains("\"")){ // parasCMD = parasCMD.Replace("\"",""); // paras.SetValue(parasCMD,0); //// paras.SetValue(parasCMD,0); // } // else // paras.SetValue(int.Parse(parasCMD),0); // paras[0] = int.Parse( parasCMD ); } } MethodInfo[] thods = type.GetMethods(); // MethodInfo method = type.GetMethod(method_str,System.Reflection.BindingFlags.); MethodInfo method = type.GetMethod(method_str); if (null == method) { XLogger.Log(target + " not have a " + method_str + " method."); return(null); } object returnValue = method.Invoke(target, paras); return(returnValue); }
/// <summary> /// XBoxInputのインターフェースを作成 /// </summary> /// <param name="id">ユーザーID</param> /// <param name="type">XBoxInputのUserID</param> /// <returns>作成成功か?</returns> public static bool CreateXBoxInterface(UserID id, XBoxInput.XBKeyCode.UserCode user) { int i = (int)id; XLogger.Log("Create interface= XVInputController: id= " + i.ToString()); m_input[i] = new XVInputController(user); return(true); }
public static void Transition() { var totalState = AssetsUtilites.FindAssetsByType <BTState>(); for (int i = 0; i < totalState.Length; i++) { XLogger.Log(totalState[i].name); } }
void Print() { GameObject[] obj = (GameObject[])GameObject.FindObjectsOfType(typeof(GameObject)); foreach (GameObject o in obj) { XLogger.Log(o.name); //o.hideFlags = HideFlags.None; // https://docs.unity3d.com/ScriptReference/HideFlags.html } }
/// <summary> /// 残弾数の追加 /// </summary> /// <param name="val">追加量:(value > 0)</param> public void AddBullet(int val) { XLogger.LogValidObject(val <= 0, "Invalid Argument MagazineUnit AddBullet: " + val.ToString()); bulletNum += val; if (bulletNum >= capacity) { bulletNum = capacity; } XLogger.Log("Magazine AddBullet: " + val.ToString() + " " + bulletNum.ToString() + "/" + capacity.ToString()); }
/// <summary> /// 残弾数の減算 /// </summary> /// <param name="val">追加量:(value > 0)</param> public void SubBullet(int val) { XLogger.LogValidObject(val <= 0, "Invalid Argument MagazineUnit SubBullet: " + val.ToString()); bulletNum -= val; if (bulletNum < 0) { bulletNum = 0; XLogger.LogError("Bullet Overflow"); } XLogger.Log("Magazine SubBullet: " + val.ToString() + " " + bulletNum.ToString() + "/" + capacity.ToString()); }
object InvokeMethod(MethodInfo methodInfo, params object[] paras) { object result = methodInfo.Invoke(_target, paras); XLogger.Log(result ?? "Void Method"); if (isDebugBreak) { Debug.Break(); } return(result); }
public void OnNextClick() { dialogAnim.SetTrigger("continue"); dialogCount++; if (dialogCount > 2) { XLogger.Log("Finish Story"); InputManager.Instance.InputDetectionActive = true; gameObject.SetActive(false); } }