Esempio n. 1
0
        private static void WriteWatchFace(string outputDirectory, string outputFileName, string imagesDirectory, WatchFace.Parser.WatchFace watchFace)
        {
            try
            {
                Logger.Debug("Reading referenced images from '{0}'", imagesDirectory);
                var imagesReader = new ResourcesLoader(imagesDirectory);
                imagesReader.Process(watchFace);

                Logger.Trace("Building parameters for watch face...");
                var descriptor = ParametersConverter.Build(watchFace);

                var baseFilename = Path.GetFileNameWithoutExtension(outputFileName);
                GeneratePreviews(descriptor, imagesReader.Images, outputDirectory, baseFilename);

                Logger.Debug("Writing watch face to '{0}'", outputFileName);
                using (var fileStream = File.OpenWrite(outputFileName))
                {
                    var writer = new Writer(fileStream, imagesReader.Resources, ColorType.colorType);
                    writer.Write(descriptor);
                    fileStream.Flush();
                }
            }
            catch (Exception e)
            {
                Logger.Fatal(e);
                File.Delete(outputFileName);
            }
        }
Esempio n. 2
0
    public void SetAvatarVo(AvatarVO value)
    {
        if (value != null)
        {
            avatarvo         = value;
            readyImg.enabled = avatarvo.isReady;
            nameText.text    = avatarvo.account.uuid + "";

            nameText.text = nameText.text.Substring(0, 6).ToString() + "..";

            scoreText.text = avatarvo.scores + "";
            if (dir != "B")
            {
            }
        }
        else
        {
            headerIcon.preserveAspect = false;
            nameText.text             = "";
            readyImg.enabled          = false;
            bankerImg.enabled         = false;
            scoreText.text            = "";
            ResourcesLoader.Load <Sprite>("BaseAssets/UI_Online/UI_Public/head0", (sprite) =>
            {
                headerIcon.overrideSprite = sprite;
                SetHeadSprite();
            });

            //headerIcon.sprite = Resources.Load("Image/morentouxiang", typeof(Sprite)) as Sprite;
            headerIcon.preserveAspect = true;
        }
    }
Esempio n. 3
0
    void Start()
    {
        instance = this;
        InitEnvironment();
        if (AssetBundleManager.instance.LoadMode == AssetBundleLoadMode.LoadFromWWW)
        {
            BundleUpdate.instance.CompareUpdate(() =>
            {
                ResourcesLoader.Load <TextAsset>("BaseAssets/Lua/ooo.lua", (luaScript) =>
                {
                    luaenv.DoString(@luaScript.text);

                    StartCoroutine(LoadScene());
                });
            });
        }
        else
        {
            //TextAsset luaScript = Resources.Load<TextAsset>("ooo.lua");
            //luaenv.DoString(@luaScript.text);
            //ResourcesLoader.instance.testC();
            StartCoroutine(LoadScene());
        }


        IPAddress[] address = Dns.GetHostAddresses("www.baidu.com");
        APIS.tcpFamily              = address[0].AddressFamily;
        Screen.sleepTimeout         = SleepTimeout.NeverSleep;
        Application.targetFrameRate = 30;
        percentV = 0;
    }
Esempio n. 4
0
    public void ShowNN()
    {
        if (shouPai == null || shouPai.Count <= 0)
        {
            return;
        }
        if (GameDataNN.Instance.HandCard.Equals(null) || GameDataNN.Instance.HandCard.cbCardData == null || GameDataNN.Instance.HandCard.cbCardData.Length <= 0)
        {
            return;
        }
        int allCard = 0;

        for (int i = 0; i < 5; i++)
        {
            //shouPai[i].color = mcolor;
            int carid = NetUtil.PuCardChange((PU_KE)GameDataNN.Instance.HandCard.cbCardData[myselfInfo.chairId].CardData[i]);
            ResourcesLoader.Load <Sprite>("PuKe/card_" + carid, (sprite) =>
            {
                shouPai[i].sprite = sprite;
                shouPai[i].transform.localEulerAngles = euler;
                if (carid % 13 < 10 && carid < 53)
                {
                    allCard += carid % 13;
                }
            });
        }
        SetPuKType(GameDataNN.Instance.gameEnd.wSpecialType[myselfInfo.chairId], allCard);
        MyDebug.Log("================游戏结束手牌数据===============");
    }
Esempio n. 5
0
    public void SetroundScore(CMD_MB_ROUND_INFO value, int dex)
    {
        info = MainNewsDataManager.instance.currentQuery;
        ResourcesLoader.Load <Sprite>("BaseAssets/UI_Online/Hall/UIPanel_Record/Type" + info.kindId, (sprite) => {
            type.sprite = sprite;
            type.SetNativeSize();
        });

        dataText.text = "第 " + (dex + 1) + " 局";

        for (int i = 0; i < nameList.Count; i++)
        {
            nameStr = NetUtil.BytesToString(info.queryinfo.PersonalUserScoreInfo[i].szUserNicname);
            if (info.queryinfo.PersonalUserScoreInfo[i].dwUserID <= 0)
            {
                nameList[i].transform.parent.gameObject.SetActive(false);
            }
            else
            {
                nameList[i].transform.parent.gameObject.SetActive(true);
                nameList[i].text  = NetUtil.BytesToString(info.queryinfo.PersonalUserScoreInfo[i].szUserNicname);
                scoreList[i].text = value.roomScore[i].IScore + "";
            }
        }
    }
Esempio n. 6
0
    // Use this for initialization
    IEnumerator Start()
    {
        CUtils.DebugCastTime("LoadingFirst.Start");
        //load manifest
        ResourcesLoader.Initialize();
        CUtils.DebugCastTime("LoadingFirst.Initialize");
        LogSys();
        LoadFirstHelper.LoadFileManifest(sceneAssetBundleName, sceneName);
        yield return(null);

#if  UNITY_ANDROID //&& !UNITY_EDITOR
        if (ManifestManager.fileManifest == null)
        {
            //obb丢失
        }
#endif
        Hugula.Localization.language = PlayerPrefs.GetString("Language", Application.systemLanguage.ToString());
        yield return(new WaitForLanguageHasBeenSet());

        if (ManifestManager.CheckNeedUncompressStreamingAssets())
        {
            // todo
        }

        LoadFirstHelper.BeginLoadScene(enterLua);
    }
Esempio n. 7
0
 public void Load()
 {
     ResourcesLoader.Load <Sprite>("baseassets/ui_online/ui_public/BG_Popup", (sprite) =>
     {
         obj.overrideSprite = sprite;
     });
 }
Esempio n. 8
0
    public IEnumerator LoadImg()
    {
        headIcon = LoginData.wxUserInfo.headimgurl;
        //开始下载图片
        if (headIcon != null && headIcon != "")
        {
            headIconImg.preserveAspect = false;
            var www = new WWW(headIcon);
            yield return(www);

            //下载完成,保存图片到路径filePath
            try
            {
                GlobalDataScript.Instance.weChatInformation = new WeChatInformation();
                texture2D = www.texture;
                //将图片赋给场景上的Sprite
                GlobalDataScript.Instance.weChatInformation.headIcon = Sprite.Create(texture2D,
                                                                                     new Rect(0, 0, texture2D.width, texture2D.height), new Vector2(0, 0));
                headIconImg.sprite         = GlobalDataScript.Instance.weChatInformation.headIcon;
                headIconImg.preserveAspect = true;
            }
            catch (Exception e)
            {
                MyDebug.Log("LoadImg" + e.Message);
            }
        }
        else
        {
            ResourcesLoader.Load <Sprite>("BaseAssets/UI_Online/UI_Public/head" + GlobalDataScript.userData.dwCustomID, (sprite) =>
            {
                headIconImg.sprite         = sprite;
                headIconImg.preserveAspect = true;
            });
        }
    }
Esempio n. 9
0
        public static void Show(string text, string caption, MessageBoxButton[] btns)
        {
#if MESSAGEBOX_DEBUG
            Debug.LogFormat("MessageBox.Show {0} frame={1}", text, Time.frameCount);
#endif
            if (m_messageBox != null)
            {
                m_messageBox.gameObject.SetActive(true);
                m_messageBox.ShowContent(text, caption, btns);
#if MESSAGEBOX_DEBUG
                Debug.LogFormat("m_messageBox.ShowContent {0} frame={1} ", text, Time.frameCount);
#endif
            }
            else if (!m_isloading)
            {
#if MESSAGEBOX_DEBUG
                Debug.LogFormat("Show {0} load asset frame={1}", text, Time.frameCount);
#endif
                m_isloading = true;
                var m_messageBoxInfo = new MessageBoxInfo();
                m_messageBoxInfo.text    = text;
                m_messageBoxInfo.caption = caption;
                m_messageBoxInfo.btns    = btns;
                ResourcesLoader.StartCoroutine1(LoadMessageBox(m_messageBoxInfo));
            }
        }
Esempio n. 10
0
    private void Start()
    {
        ResourcesLoader loader = new ResourcesLoader("\\Data\\");

        blocksMaterials = loader.Load <Substance>("Blocks\\");
        print(blocksMaterials["air"].GetName());
    }
Esempio n. 11
0
        private static void WriteWatchFace(string outputDirectory, string outputFileName, string imagesDirectory, Parser.WatchFace watchFace)
        {
            try
            {
                Logger.Debug("从 '{0}' 读取参考图像", imagesDirectory);
                var imagesReader = new ResourcesLoader(imagesDirectory);
                imagesReader.Process(watchFace);

                Logger.Trace("建构表盘参数...");
                var descriptor = ParametersConverter.Build(watchFace);

                var baseFilename = Path.GetFileNameWithoutExtension(outputFileName);
                GeneratePreviews(descriptor, imagesReader.Images, outputDirectory, baseFilename);

                Logger.Debug("写入表盘到: '{0}'", outputFileName);
                using (var fileStream = File.OpenWrite(outputFileName))
                {
                    var writer = new Writer(fileStream, imagesReader.Resources);
                    writer.Write(descriptor);
                    fileStream.Flush();
                }
            }
            catch (Exception e)
            {
                Logger.Fatal(e);
                File.Delete(outputFileName);
            }
        }
Esempio n. 12
0
    public void salleCentral()
    {
        /// CREATION DE LA SALLE ======================================================
        int xMilieux = Constantes.HAUTEUR_PLATEAU / 2;
        int yMilieux = Constantes.LARGEUR_PLATEAU / 2;

        string name0 = "";


        for (int posX = xMilieux - Constantes.RADIUS_SPAWN; posX < xMilieux + Constantes.RADIUS_SPAWN; posX++)
        {
            for (int posY = yMilieux - Constantes.RADIUS_SPAWN; posY < xMilieux + Constantes.RADIUS_SPAWN; posY++)
            {
                name0 = posY.ToString() + "-" + posX.ToString();
                GameObject tileGO = GameObject.Find(name0);
                Tile       tiler  = tileGO.GetComponent <Tile> ();
                tiler.type = Tile.Type.Sol;
            }
        }

        // ========= Création du joueur
        Coord      playerCoord = new Coord(xMilieux, yMilieux);
        GameObject player      = Instantiate(ResourcesLoader.Load <GameObject>("ampoule"), playerCoord.ToVector3(), Quaternion.identity, transform);

        //Instantiate (ResourcesLoader.Load<GameObject> ("MonstreTempReel"), new Coord (xMilieux + 2, yMilieux + 2).ToVector3 (), Quaternion.identity, transform);
    }
Esempio n. 13
0
    public object Convert(object target, Type targetType)
    {
        string  rawImageUrl = target.ToString();
        Texture tex         = ResourcesLoader.LoadAsset <Texture> (rawImageUrl.ToLower() + Common.CHECK_ASSETBUNDLE_SUFFIX, rawImageUrl);

        return(tex);
    }
        public R GetAsset(string assetName, string groupName = "")
        {
            IMappingAsset <R> mappingAsset;
            //find assetbundle name
            string abName = m_AssetBundleMappingAsset.GetAassetBundleName(assetName);

            if (string.IsNullOrEmpty(abName))
            {
#if UNITY_EDITOR
                Debug.LogWarningFormat("{1} doesn't contains asset {0}.", assetName, typeof(IMappingAsset <R>));
#endif
                return(null);
            }

            int refCount = AddRefer(abName);

            if (!string.IsNullOrEmpty(groupName))
            {
                AddGroup(groupName, abName);
            }

            if (m_MappingAssetCache.TryGetValue(abName, out mappingAsset))
            {
                return(mappingAsset.GetAsset(assetName));
            }
            else
            {
                mappingAsset = ResourcesLoader.LoadAsset <IMappingAsset <R> >(abName, Utils.CUtils.GetAssetName(abName));
                m_MappingAssetCache.Add(abName, mappingAsset);
                return(mappingAsset.GetAsset(assetName));
            }
        }
Esempio n. 15
0
    private void AddItemGUI()
    {
        EditorGUI.indentLevel = 1;

        EditorGUILayout.LabelField("Add Item", EditorStyles.boldLabel);

        EditorGUI.indentLevel = 2;

        var name   = EditorGUILayout.TextField("Name:", addItem.name);
        var icon   = EditorGUILayout.TextField("Icon:", addItem.icon);
        var sprite = EditorGUILayout.TextField("Sprite:", addItem.sprite);

        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(30);
        if (GUILayout.Button("Add Item"))
        {
            ResourcesLoader.SaveObject("Assets/Resources/Entities/Items/", addItem.name, addItem);
            ItemEntities.Update();
        }
        EditorGUILayout.EndHorizontal();
        EditorGUI.indentLevel = 1;

        if (GUI.changed)
        {
            addItem.name   = name;
            addItem.icon   = icon;
            addItem.sprite = sprite;
        }
    }
Esempio n. 16
0
        /// <summary>
        /// Load the specified localization dictionary.
        /// </summary>
        static bool LoadDictionary(string value)
        {
            if (value.Equals(SystemLanguage.ChineseSimplified.ToString()))
            {
                value = SystemLanguage.Chinese.ToString();
            }

            string assetName = Common.LANGUAGE_PREFIX + value.ToLower();
            string abName    = CUtils.GetRightFileName(assetName + Common.CHECK_ASSETBUNDLE_SUFFIX);

            var main = ResourcesLoader.LoadAsset <BytesAsset>(abName, assetName);

            if (main != null)
            {
                byte[] txt = main.bytes;
#if UNITY_EDITOR
                Debug.Log(mLanguage + " is loaded " + txt.Length + " " + Time.frameCount);
#endif
                if (txt != null)
                {
                    Load(txt);
                }
                CacheManager.Subtract(abName);
                localizationHasBeenSet = true;
            }
            else
            {
                if (!value.ToLower().Equals(SystemLanguage.English.ToString().ToLower()))
                {
                    language = SystemLanguage.English.ToString();
                }
            }

            return(false);
        }
        public void GetAssetAsync(string assetName, System.Action <R> onComplete, string groupName = "")
        {
            IMappingAsset <R> mappingAsset;
            //find assetbundle name
            string abName = m_AssetBundleMappingAsset.GetAassetBundleName(assetName);

            if (string.IsNullOrEmpty(abName))
            {
#if UNITY_EDITOR
                Debug.LogWarningFormat("{1} doesn't contains asset {0}.", assetName, typeof(IMappingAsset <R>));
#endif
                return;
            }

            int refCount = AddRefer(abName);

            if (!string.IsNullOrEmpty(groupName))
            {
                AddGroup(groupName, abName);
            }

            if (m_MappingAssetCache.TryGetValue(abName, out mappingAsset))
            {
                var asset = mappingAsset.GetAsset(assetName);
                onComplete(asset);
                #if UNITY_EDITOR
                if (asset == null)
                {
                    Debug.LogWarningFormat("{0} doesn't contains asset {1}.", mappingAsset, assetName);
                }
                #endif
            }
            else
            {
                Action <object, object> onComplete1 = (data, userData) =>
                {
                    IMappingAsset <R> mappingAsset1 = (IMappingAsset <R>)data;
                    if (!m_MappingAssetCache.ContainsKey(abName))
                    {
                        m_MappingAssetCache.Add(abName, mappingAsset1);
                    }
                    R asset = mappingAsset1.GetAsset(assetName);
                    onComplete(asset);

                    //keep reference count as 1
                    int count = 0;
                    if (m_ABCacheSubCount.TryGetValue(abName, out count))
                    {
                        for (int i = 1; i < count; i++)
                        {
                            CacheManager.Subtract(abName);
                        }
                        m_ABCacheSubCount.Remove(abName);
                    }
                };

                m_ABCacheSubCount[abName] = refCount;//记录异步加载次数
                ResourcesLoader.LoadAssetAsync(abName, null, typeof(IMappingAsset <R>), onComplete1, null);
            }
        }
Esempio n. 18
0
    public void SetRenShu(int dex)
    {
        renShu = dex;
        if (dex == 1)
        {
            renShu     = 3;
            ptog3.isOn = true;
            People_4.SetActive(true);
            ResourcesLoader.Load <Sprite>("BaseAssets/UI_Online/Hall/UIPanel_CreateRoom/3Press", (sprite) =>
            {
                People_3.GetComponent <Image>().overrideSprite = sprite;
            });
        }

        if (dex == 5)
        {
            ptog3.isOn = true;
            People_4.SetActive(false);
            ResourcesLoader.Load <Sprite>("BaseAssets/UI_Online/Hall/UIPanel_CreateRoom/NN5Press", (sprite) =>
            {
                People_3.GetComponent <Image>().overrideSprite = sprite;
            });
        }

        if (dex == 6)
        {
            ptog3.isOn = true;
            People_4.SetActive(false);
            ResourcesLoader.Load <Sprite>("BaseAssets/UI_Online/Hall/UIPanel_CreateRoom/NN6Press", (sprite) =>
            {
                People_3.GetComponent <Image>().overrideSprite = sprite;
            });
        }
        SetConst();
    }
Esempio n. 19
0
    public new void Start()
    {
        base.Start();

        var trackObjects = Resources.LoadAll(ResourcesLoader.Track_Objects, typeof(GameObject)).Cast <GameObject>();

        buttons = new List <Button>();

        foreach (var obj in trackObjects)
        {
            var trackObj = obj.GetComponent <TrackObject>();

            var gameObj = new GameObject();
            gameObj.transform.SetParent(transform, false);
            gameObj.AddComponent <RectTransform>();
            gameObj.GetComponent <RectTransform>().sizeDelta = new Vector2(10, 10);

            var button = gameObj.AddComponent <Button>();
            var image  = gameObj.AddComponent <Image>();

            button.targetGraphic = image;
            image.sprite         = obj.GetComponent <TrackObject>().Icon;

            button.onClick.AddListener(() => {
                CursorEditor.CreateNewObject(ResourcesLoader.LoadTrackObject(trackObj.ID));
                buttonsRect.gameObject.SetActive(false);
                CursorEditorUI.Exit();
            });

            buttons.Add(button);
        }
    }
Esempio n. 20
0
    public void setZhongDao()
    {
        for (int i = 0; i < 5; i++)
        {
            if (GlobalDataScript.Instance.roomInfo.maPaiId > 0)
            {
                int a = NetUtil.PuCardChange((PU_KE)GameDataSSS.Instance.sCompare.cbMidCard[myselfInfo.chairId].arrayItem[i]);
                if (a == GlobalDataScript.Instance.roomInfo.maPaiId)
                {
                    zdMalist[i].mapai.gameObject.SetActive(true);
                }
                else
                {
                    zdMalist[i].mapai.gameObject.SetActive(false);
                }
            }
            ResourcesLoader.Load <Sprite>("PuKe/card_" + NetUtil.PuCardChange((PU_KE)GameDataSSS.Instance.sCompare.cbMidCard[myselfInfo.chairId].arrayItem[i]), (sprite) =>
            {
                zdlist[i].enabled = true;
                zdlist[i].sprite  = sprite;
            });
        }

        ShowType(GameDataSSS.Instance.sCompare.w_hand_card_type[myselfInfo.chairId].arrayItem[1], 1);
        ShowFront(GameDataSSS.Instance.sCompare.nCompareResult[myselfInfo.chairId].arrayItem[1], 1);
    }
Esempio n. 21
0
    private void EditItemGUI()
    {
        EditorGUI.indentLevel = 1;
        EditorGUILayout.LabelField("Edit Item", EditorStyles.boldLabel);
        EditorGUI.indentLevel = 2;
        string[] values       = ItemEntities.items.Values.Select(x => x.Name).ToArray <string>();
        int      index        = values.ToList().IndexOf(editItem.Name);
        int      currentIndex = EditorGUILayout.Popup("Select Item", index, values);
        var      icon         = EditorGUILayout.TextField("Icon:", editItem.icon);
        var      sprite       = EditorGUILayout.TextField("Sprite:", editItem.sprite);

        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(30);
        if (GUILayout.Button("Edit Item"))
        {
            ResourcesLoader.SaveObject("Assets/Resources/Entities/Items/", editItem.name, editItem);
            ItemEntities.Update();
        }
        EditorGUILayout.EndHorizontal();
        EditorGUI.indentLevel = 1;

        if (GUI.changed)
        {
            string nName = values[currentIndex];
            if (nName != editItem.Name)
            {
                editItem = ItemEntities.items[nName];
            }
            else
            {
                editItem.icon   = icon;
                editItem.sprite = sprite;
            }
        }
    }
Esempio n. 22
0
    public void Drop(ItemStack stack)
    {
        ItemContainer drop = Instantiate(ResourcesLoader.LoadPref("ItemContainer")).GetComponent <ItemContainer>();

        drop.transform.position = transform.position;
        drop.SetItem(stack);
    }
Esempio n. 23
0
 private void ReloadStatics()
 {
     SceneHelper.Reload();
     ResourcesLoader.Reload();
     GameState.State = GameState.States.Active;
     Player.Reload();
     UIController.Reload();
 }
Esempio n. 24
0
 // Use this for initialization
 void Start()
 {
     StartCoroutine(LoadAssetBundles());                                                  //load Asset Bundles from server
     geometryObjectDataManager = Resources.Load <GeometryObjectData>("ScriptableObject"); //load GeometryObjectData from Recources
     data              = ResourcesLoader.LoadResourceTextFile("Data");                    //load GameDataJson that contain PrefabNames array
     allPrefbNames     = data.PrefabNames;
     gameArea.OnClick += GameArea_OnClick;
 }
    private void SpawnDeathParticles()
    {
        //GameObject deathParticles = Resources.Load(pathToObject) as GameObject;

        GameObject deathParticles = ResourcesLoader.LoadGameObject(pathToObject);

        Instantiate(deathParticles, transform.position, Quaternion.LookRotation(Vector3.up));
    }
Esempio n. 26
0
    private void AddStack(ItemStack stack)
    {
        Slot     freeSlot = slots.FirstOrDefault(x => !x.isBlock);
        DragItem dragItem = Instantiate(ResourcesLoader.LoadPref("ItemIcon")).GetComponent <DragItem>();

        dragItem.InitItem(stack);
        dragItem.SetSlot(freeSlot);
    }
Esempio n. 27
0
 void LoadPrefab(string assetName)
 {
     if (!string.IsNullOrEmpty(assetName))
     {
         var abName = assetBundleName;
         m_LoadId = ResourcesLoader.LoadAssetAsync(assetBundleName, assetName, typeof(GameObject), OnCompleted, OnEnd);
     }
 }
Esempio n. 28
0
 private static void LoadItems()
 {
     object[] objects = ResourcesLoader.LoadAllObjectInDirectory("Entities/Items");
     foreach (Item item in objects)
     {
         items.Add(item.Name, item);
     }
 }
Esempio n. 29
0
 public GameObject Prefab(string path)
 {
     if (_resourcesLoader == null)
     {
         _resourcesLoader = new ResourcesLoader <GameObject>(route);
     }
     return(_resourcesLoader.LoadResource(path));
 }
Esempio n. 30
0
        public static GameObject CreateFlex(FlexGOInfo info)
        {
            var name   = info.node.type.ToString() + " Flex";
            var flexGO = ResourcesLoader.Load("GameObjects/" + name) as GameObject;
            var go     = Object.Instantiate(flexGO, info.pos, Quaternion.LookRotation(info.fwd)) as GameObject;

            return(go);
        }