Exemple #1
0
    public void SetPanelVisible(string panelName, bool visible)
    {
        Transform trans = null;

        trans = this.transform.parent.Find(panelName);
        if (null != trans)
        {
            NGUITools.SetActive(trans.gameObject, visible);
        }
        else
        {
            LogicSystem.LogicLog("Debug:Can not find " + panelName);
        }
    }
Exemple #2
0
 public static bool AttachGameObject(Transform parent, Transform obj, string path)
 {
     if (null != obj && null != parent)
     {
         Transform t = LogicSystem.FindChildRecursive(parent, path);
         if (null != t)
         {
             obj.transform.parent        = t;
             obj.transform.localPosition = Vector3.zero;
             obj.transform.localRotation = Quaternion.identity;
             return(true);
         }
         else
         {
             LogicSystem.LogicLog("AttachGameObject obj{1} can't attach to parent{1} at bone {2}", obj.name, parent.name, path);
         }
     }
     return(false);
 }
Exemple #3
0
    public static Vector3 ToVector3(string vec)
    {
        Vector3 path   = Vector3.zero;
        string  strPos = vec;

        try {
            string[] result = strPos.Split(s_VecSplitString, StringSplitOptions.None);
            if (result != null && result.Length == 3)
            {
                path = new Vector3(Convert.ToSingle(result[0]),
                                   Convert.ToSingle(result[1]),
                                   Convert.ToSingle(result[2]));
            }
        } catch (System.Exception ex) {
            LogicSystem.LogicLog("ConvertVector3 vec:{0} stacktrace:{1}",
                                 vec, ex.StackTrace);
        }
        return(path);
    }
Exemple #4
0
 /// <summary>
 /// 播放特效,指定时间后删除
 /// </summary>
 /// <param name="args"></param>
 public void AddTemporaryEffect(TemporaryEffectArgs args)
 {
     if (null != args)
     {
         UnityEngine.Object original = Resources.Load(args.Resource);
         if (null != original)
         {
             Vector3    pos = new Vector3(args.X, args.Y, args.Z);
             GameObject obj = ResourceSystem.NewObject(original) as GameObject;
             if (null != obj)
             {
                 obj.transform.position = pos;
                 obj.transform.rotation = Quaternion.identity;
                 GameObject.Destroy(obj, args.Duration);
             }
         }
         else
         {
             LogicSystem.LogicLog("Can't load resource {0} !", args.Resource);
         }
     }
 }