Beispiel #1
0
    /// <summary>
    /// 创建一个Lable,返回一个GfxLable实例,失败返回null
    /// </summary>
    /// <param name="swf_id">哪个SWF</param>
    /// <param name="text">内容</param>
    /// <param name="col">颜色</param>
    public static GfxLable CreateLable(string text, Color col)
    {
        if (SFGFxMovieManager.Instance == null)
        {
            Trace.LogError("SFGFxMovieManager没有初始化,请不要在Awake或Start中创建!");
            return(null);
        }

        if (!bInit)
        {
            Trace.LogError("GfxLableManager必须初始化!");
            return(null);
        }
        //有可能DynamicMovie还没有创建完成.
        if (GfxDynamicMovie.Instance == null)
        {
            //Trace.LogError("DynamicMovie尚未创建完成,请等待创建完成后再调用。");
            return(null);
        }
        Value ins = new Value();

        if (!GfxDynamicMovie.Instance.AttachMovie(ref ins, LableAS3RefernceName, LableAS3RefernceName + index, -1))
        {
            Trace.LogError("Flash -- Lable创建失败!");
            ins = null;
            return(null);
        }
        GfxLable gf = new GfxLable(ins, text, col, index);

        m_LableMap.Add(index, gf);
        index++;
        return(gf);
    }
Beispiel #2
0
    /// <summary>
    /// 摧毁指定的Lable
    /// </summary>
    /// <param name="instance">需要清除的Lable</param>
    public static void Destroy(GfxLable instance)
    {
        if (Movie.GetSingleton <GfxDynamicMovie>() == null)
        {
            return;
        }
        if (null == instance)
        {
            return;
        }
        int id = instance.ID;

        if (m_LableMap.ContainsKey(id))
        {
            if (GfxDynamicMovie.Instance != null)
            {
                GfxDynamicMovie.Instance.RemoveMovieAS3(instance.Instance);
            }
            instance.Clear();
            m_LableMap[id] = null;
            m_LableMap.Remove(id);
            instance = null;
        }
    }