Beispiel #1
0
    public MyJson.IJsonNode Parser(Component com, NeedList list)
    {
        UITexture t    = com as UITexture;
        var       json = new MyJson.JsonNode_Object();


        if (t.mainTexture != null)
        {
            string needtex = AtlasMgr.SaveTexture(t.mainTexture, System.IO.Path.Combine(Application.streamingAssetsPath, "nguitex"));
            json["mainTexture"] = new MyJson.JsonNode_ValueString(needtex);
            list.AddDependTexture(needtex);
            if (t.shader != null)
            {
                string shader = t.shader.name;
                json["shader"] = new MyJson.JsonNode_ValueString(shader);
            }
        }
        else
        {
            Debug.LogWarning("不支持 导出使用材质的UITexture");
        }

        json["uvRect"] = new MyJson.JsonNode_ValueString(ComponentTypeConvert.RectToString(t.uvRect));
        ComponentParser.ParserWidget(json, t);

        return(json);
    }
    public UIAtlas GetActiveAtlas(string m_Icon)
    {
        AtlasMgr _mgr = AtlasMgr.mInstance;

        if (_mgr.equipAtlas.GetSprite(m_Icon) != null)
        {
            return(_mgr.equipAtlas);
        }
        else if (_mgr.commonAtlas.GetSprite(m_Icon) != null)
        {
            return(_mgr.commonAtlas);
        }
        else if (_mgr.headAtlas[0].GetSprite(m_Icon) != null)
        {
            return(_mgr.headAtlas[0]);
        }
        else if (_mgr.headAtlas[1].GetSprite(m_Icon) != null)
        {
            return(_mgr.headAtlas[1]);
        }
        else if (_mgr.itemAtlas.GetSprite(m_Icon) != null)
        {
            return(_mgr.itemAtlas);
        }
        else if (_mgr.skillAtlas.GetSprite(m_Icon) != null)
        {
            return(_mgr.skillAtlas);
        }
        return(null);
    }
Beispiel #3
0
        public void UnInit()
        {
            Log.Info("NBsn.C_Global.UnInit()");

            LuaConsoleGesture.UnInit();
            m_LuaConsoleGesture = null;

            Lua.UnInit();
            m_Lua = null;

            UIMgr.UnInit();
            m_UIMgr = null;

            AtlasMgr.UnInit();
            m_AtlasMgr = null;

            ResMgr.UnInit();
            m_ResMgr = null;

            ABMgr.UnInit();
            m_ABMgr = null;

            Coroutine.UnInit();
            m_Coroutine = null;

            EventMgr.UnInit();
            m_EventMgr = null;

            Log.UnInit();
            m_Log = null;

            m_tfMain = null;
            m_Main   = null;
            m_goMain = null;
        }
Beispiel #4
0
    public void init(int iCardNum, IMain delt)
    {
        _delegate = delt;
        _iCardNum = iCardNum + 1;
        string str = "finds__" + iCardNum;

        gameObject.GetComponent <Image>().sprite = AtlasMgr.getInstance().getSpt("res", str);
    }
 public static AtlasMgr getInstance()
 {
     if (atMgr == null)
     {
         atMgr = go.GetComponent <AtlasMgr> ();
     }
     return(atMgr);
 }
Beispiel #6
0
 void initParas()
 {
     labNum1 = transform.GetChild(0).GetComponent <Text> ();
     img1    = transform.GetChild(1).GetComponent <Image> ();
     labNum2 = transform.GetChild(2).GetComponent <Text> ();
     img2    = transform.GetChild(3).GetComponent <Image> ();
     labNum3 = transform.GetChild(4).GetComponent <Text> ();
     atMgr   = new AtlasMgr();
 }
Beispiel #7
0
    /// <summary>
    /// 移除sprite回调
    /// </summary>
    /// <param name="spName"></param>
    /// <param name="callBack"></param>
    public void unLoad(string spName, Action <Sprite, string> callBack)
    {
        spName = spName.ToLower();
        string resName = AtlasMgr.getName(spName);

        if (pools.ContainsKey(resName))
        {
            pools[resName].removeHandler(spName, callBack);
        }
    }
Beispiel #8
0
 //获取Sprite
 public void getObj(string spName, Action <Sprite> callBack, E_PoolMode mode = E_PoolMode.Time, E_PoolType pType = E_PoolType.Atlas, float time = 60)
 {
     if (AtlasMgr.hasKey(spName))
     {
         string resName = AtlasMgr.getName(spName);
         createPool(resName, mode, pType, time);
         pools[resName].getObj(spName, callBack);
     }
     else
     {
         Debug.LogError("没有找到bundle名称 spName " + spName);
     }
 }
Beispiel #9
0
    public MyJson.IJsonNode Parser(Component com, NeedList needlist)
    {
        UISprite t    = com as UISprite;
        var      json = new MyJson.JsonNode_Object();

        //t.atlas atlas 有特殊的打包逻辑
        string atlas = AtlasMgr.SaveAtlas(t.atlas, System.IO.Path.Combine(Application.streamingAssetsPath, "nguiatlas"), System.IO.Path.Combine(Application.streamingAssetsPath, "nguitex"));

        json["atlas"] = new MyJson.JsonNode_ValueString(atlas);
        if (needlist != null)
        {
            needlist.AddDependAtlas(atlas);
        }

        json["spriteName"] = new MyJson.JsonNode_ValueString(t.spriteName);
        json["spriteType"] = new MyJson.JsonNode_ValueString(t.type.ToString());

        if (t.type == UISprite.Type.Simple)
        {
            json["flip"] = new MyJson.JsonNode_ValueString(t.flip.ToString());
        }
        else if (t.type == UISprite.Type.Sliced)
        {
            json["centerType"] = new MyJson.JsonNode_ValueString(t.centerType.ToString());
            json["flip"]       = new MyJson.JsonNode_ValueString(t.flip.ToString());
        }
        else if (t.type == UISprite.Type.Tiled)
        {
        }
        else if (t.type == UISprite.Type.Filled)
        {
            json["flip"]          = new MyJson.JsonNode_ValueString(t.flip.ToString());
            json["fillDirection"] = new MyJson.JsonNode_ValueString(t.fillDirection.ToString());
            json["fillAmount"]    = new MyJson.JsonNode_ValueNumber(t.fillAmount);
            json["invert"]        = new MyJson.JsonNode_ValueNumber(t.invert);
        }
        else if (t.type == UISprite.Type.Advanced)
        {
            json["leftType"]   = new MyJson.JsonNode_ValueString(t.leftType.ToString());
            json["rightType"]  = new MyJson.JsonNode_ValueString(t.rightType.ToString());
            json["topType"]    = new MyJson.JsonNode_ValueString(t.topType.ToString());
            json["bottomType"] = new MyJson.JsonNode_ValueString(t.bottomType.ToString());
            json["centerType"] = new MyJson.JsonNode_ValueString(t.centerType.ToString());
            json["flip"]       = new MyJson.JsonNode_ValueString(t.flip.ToString());
        }

        ComponentParser.ParserWidget(json, t);

        return(json);
    }
Beispiel #10
0
    public void init(int iCardNum, int iCardType, int iPos, int iRow, Kdjl delt)
    {
        gameObject.SetActive(true);
        _iPos     = iPos;
        _iRow     = iRow;
        _bMove    = false;
        _delegate = delt;

        _iCardType = iCardType;
        _iCardNum  = iCardNum;
        _iColor    = iCardType % 2 == 1 ? 0 : 1;

        textCardNum.text = FuncMgr.getInstance().getCardNum(iCardNum, _iColor);
        var str    = "huase_" + (iCardType - 1);
        var sprite = AtlasMgr.getInstance().getSpt("res", str);

        imgBigCardType.GetComponent <Image> ().sprite = sprite;
        imgSmCardType.GetComponent <Image> ().sprite  = sprite;
    }
Beispiel #11
0
 public void setName(string name, float height)
 {
     if (namePart == null)
     {
         //创建
         GameObject bg = new GameObject("namePartBg");
         bg.transform.SetParent(CacheTrans);
         bg.transform.localPosition = new Vector3(0, height, 0);
         SpriteRenderer renderer = bg.AddComponent <SpriteRenderer>();
         AtlasMgr.setSprite(renderer, "yeqianButtonChose2");
         // renderer.drawMode = SpriteDrawMode.Sliced;
         //renderer.size = new Vector2(1.8f, 0.4f);
         GameObject go = new GameObject("namePart");
         go.transform.SetParent(bg.transform);
         go.transform.localPosition = new Vector3(0, 0, -0.05f);
         namePart = go.AddComponent <TextMesh>();
         namePart.characterSize = 0.1f;
         namePart.fontSize      = 28;
         namePart.anchor        = TextAnchor.MiddleCenter;
         namePart.alignment     = TextAlignment.Center;
     }
     namePart.text = name;
 }
Beispiel #12
0
 void Awake()
 {
     _AtlasMgr = AtlasMgr.instance;
 }
Beispiel #13
0
 //设置Image sprite
 public static void setSprite(GameObject obj, string name)
 {
     AtlasMgr.setSprite(obj.GetComponent <Image>(), name);
 }
Beispiel #14
0
        // 游戏逻辑初始化
        public void Init(GameObject goMain, NBsn.M_Main Main)
        {
            NBsn.C_Platform.Info();

            m_goMain = goMain;
            m_Main   = Main;
            m_tfMain = m_goMain.transform;

            m_Log = new NBsn.C_Log();
            Log.Init();
            NBsn.C_PathConfig.Debug();

            m_EventMgr = new NBsn.C_EventMgr();
            EventMgr.Init();

            m_Lua = new NBsn.C_Lua();
            Lua.Init();

            m_Coroutine = new NBsn.C_Coroutine();
            Coroutine.Init(m_Main);

            m_ABMgr = new NBsn.C_ABMgr();
            ABMgr.Init(null);

            m_ResMgr = new NBsn.C_ResMgr();
            ResMgr.Init();

            m_AtlasMgr = new NBsn.C_AtlasMgr();
            AtlasMgr.Init();

            m_UIMgr = new NBsn.C_UIMgr();
            UIMgr.Init(m_tfMain);

            m_LuaConsoleGesture = new NBsn.C_Gesture();
            LuaConsoleGesture.Init(
                () => {
                var pView = UIMgr.GetView("UILuaConsole") as NBsn.NMVVM.LuaConsoleV;
                pView.Show();
            }
                , EasyTouch.SwipeDirection.Right
                , EasyTouch.SwipeDirection.Down
                , EasyTouch.SwipeDirection.Left
                , EasyTouch.SwipeDirection.Up
                );

            ABMgr.LoadABManifest();
            ABMgr.LoadRes2ABId();

            Coroutine.Start(StartApp());
            // var pView = UIMgr.GetView("UIUpdate") as NBsn.NMVVM.UpdateV;
            // pView.Show();
            // //var pVM = pView.VM;
            // //pVM.TextCenter.Value = "";

            // var pUpdateRes = new NBsn.NUpdateRes.C_UpdateRes();
            // pUpdateRes.GetVerInfo();
            //Lua.DoString("require('main')");


            // C_ResLoadParam pResLoadParam = new C_ResLoadParam();
            // pResLoadParam.strPath = @"atlas\red";
            // pResLoadParam.strSuffix = "prefab";
            // var a = ResMgr.Load<Sprite>(pResLoadParam);
            // Log.Info(a);
        }
Beispiel #15
0
 void Awake()
 {
     _mInstance = this;
 }