Ejemplo n.º 1
0
    public void UpdateItem(_SourceItemData item, bool toSelect, bool isInitial)
    {
        if (item == null)
        {
            /*Debug.Log("Item is Null!");*/
            this.OnDefault();
            return;
        }

        Texture2D itemTex = GetItemTexture(item);

        if (itemTex == null)
        {
            /*Debug.Log("Texture is Null!");*/
            this.OnDefault();
            return;
        }

        if (isInitial)
        {
            initialTex      = itemTex;
            initItem        = item;
            initItem.isHide = true;
        }

        ///Show
        if (toSelect)
        {
            /*Debug.Log(item.title + " is Selected !");*/
            if (item == currentItem)
            {
                Debug.Log("There must be something wrong!");
                return;
            }
            else
            {
                currentTex  = itemTex;
                currentItem = item;
            }

            ///Hide
        }
        else
        {
            /*Debug.Log("Accessory Reselesed !");*/
            if (item == currentItem)
            {
                currentTex  = initialTex;
                currentItem = initItem;
            }
            else
            {
                Debug.Log("There must be something else wrong!");
                return;
            }
        }

        //render.material.SetTexture(texName, currentTex);
        SetTexture();
    }
Ejemplo n.º 2
0
 public void OnClickItem(_SourceItemData item, bool toSelect, bool isPlayable)
 {
     if (item.typeCode.Equals("wallpaper"))
     {
         if (OnUpdateWallpaper != null)
         {
             Debug.Log("Update wallpaper : " + item.typeCode + ", " + item.id);
             OnUpdateWallpaper(item, toSelect);
         }
     }
     else if (item.typeCode.Equals("dance"))
     {
         Debug.Log("Update Dance: " + item.typeCode + ", " + item.id);
         if (OnUpdateDance != null)
         {
             OnUpdateDance(item, toSelect);
         }
     }
     else
     {
         if (OnUpdateAccessory != null)
         {
             OnUpdateAccessory(item, toSelect, isPlayable);
         }
     }
 }
Ejemplo n.º 3
0
    AnimationClipEx GetPostureData(_SourceItemData item)
    {
        AnimationClipEx postureClip = null;

        if (!poseTable.ContainsKey(item))
        {
            AssetBundle ab = AssetBundle.CreateFromFile(item.isTempLoaded ? item.TempLocalPath : item.DecorationLocalPath);

            postureClip = ab.Load("anime") as AnimationClipEx;

            if (postureClip != null)
            {
                poseTable.Add(item, postureClip);
                Debug.Log("Clip is " + (postureClip.animationClip == null) + "?\n" + postureClip.ToString());
            }
            else
            {
                Debug.Log("AssetBundle Load \"anime\" is back NULL!!!");
            }

            ab.Unload(false);
        }
        else
        {
            postureClip = poseTable[item];
        }
        return(postureClip);
    }
Ejemplo n.º 4
0
    void PrintBoneWeightInfo(GameObject obj, _SourceItemData item)
    {
        SkinnedMeshRenderer smr = obj.GetComponentInChildren <SkinnedMeshRenderer>();

        if (smr == null)
        {
            return;
        }

        Transform[] bs = smr.bones;

        BoneWeight[] bws = smr.sharedMesh.boneWeights;
        System.Text.StringBuilder stsb = new System.Text.StringBuilder();
        if (item != null)
        {
            stsb.Append(item.typeCode + " : \n");
        }
        int i = 0;

        while (i < bws.Length)
        {
            BoneWeight bw = bws[i];
            stsb.Append(string.Format(format, i, bs[bw.boneIndex0].name, bw.weight0));
            stsb.Append(string.Format(format, i, bs[bw.boneIndex1].name, bw.weight1));
            stsb.Append(string.Format(format, i, bs[bw.boneIndex2].name, bw.weight2));
            stsb.Append(string.Format(format, i, bs[bw.boneIndex3].name, bw.weight3));
            i++;
        }

        Debug.Log(stsb.ToString());
    }
Ejemplo n.º 5
0
    int  GetPostureData(_SourceItemData item)
    {
        if (poseTable == null)
        {
            FillPostureTable();
        }
//		AnimationClipEx postureClip = null;
        if (!poseTable.ContainsKey(item.title))
        {
//			AssetBundle ab = AssetBundle.CreateFromFile(item.isTempLoaded ? item.TempLocalPath : item.DecorationLocalPath);

//			postureClip = ab.Load("anime") as AnimationClipEx;
//
//			if(postureClip != null){
//				poseTable.Add(item, postureClip);
//				Debug.Log ("Clip is " + (postureClip.animationClip == null) +"?\n" + postureClip.ToString());
//			}else{
//				Debug.Log ( "AssetBundle Load \"anime\" is back NULL!!!");
//			}
//
//			ab.Unload(false);

            Debug.LogError("Local Pose Table donot contain " + item.title);
            return(0);
        }
        else
        {
            Debug.LogError("Local Pose Table contains " + item.title);
            return(poseTable[item.title]);
        }
        return(0);
    }
Ejemplo n.º 6
0
    Texture2D GetItemTexture(_SourceItemData item)
    {
        Texture2D itemTex;// = itemObjTable[item];

        //-------------------------------------------------------------
        if (itemTexTable == null)
        {
            itemTexTable = new Dictionary <_SourceItemData, Texture2D>();
        }

        if (!itemTexTable.ContainsKey(item))
        {//.title + name)){// || !itemObjTable[item.title + name]
            AssetBundle ab = AssetBundle.CreateFromFile(item.isTempLoaded ? item.TempLocalPath : item.DecorationLocalPath);

            itemTex = ab.mainAsset as Texture2D;//Object.Instantiate()

            if (itemTex != null)
            {
                /*itemTex.wrapMode = TextureWrapMode.Clamp;*/
                itemTexTable.Add(item, itemTex);
            }
            else
            {
                Debug.Log("_TextureLoader.GetItemTexture : itemTex is Null !");
            }
            ab.Unload(false);
        }
        else
        {
            itemTex = itemTexTable[item];
        }
        return(itemTex);
    }
    void HandleOnUpdateAccessory(_SourceItemData item, bool toSelect, bool isPlayable)
    {
        if (toSelect)
        {
            isAcceChanged = true;
        }
//			animIndex =  acceIndecies[Random.Range(0, 2)];
//			PlayAcceAnim();
    }
Ejemplo n.º 8
0
    public void OnShow(_SourceItemData data, ItemButtonViewManager manager)//Action<ItemButtonView> back)
    {
        this.itemData = data;

        mManager = manager;

        transform.SetParent(manager.gridTransform);
        transform.localScale = Vector3.one;
        name = string.Format("Button Item {0}", data.title);

        UpdateIconSprite();

        UpdateState();
    }
Ejemplo n.º 9
0
    public void ResetHandsToLastItem()
    {
        Debug.Log("Avatar Do Rest Hands.");

        if (lastHandsItem == null)
        {
            return;
        }

        OnUpdateHands(lastHandsItem, true, false);
        posture.SetCurPosture();

        lastHandsItem = null;
    }
    void DeletaItemData(_SourceItemData item)
    {
        if (item.isUIImageLoaded)
        {
            _InternalDataCodec.DeleteLocalData(item.UIImageLocalPath);
//			item.UIImageLocalPath = string.Empty;
//			item.isUIImageLoaded = false;
        }
        if (item.isDecorationLoaded)
        {
            _InternalDataCodec.DeleteLocalData(item.DecorationLocalPath);
//			item.DecorationLocalPath = string.Empty;
        }
    }
Ejemplo n.º 11
0
    public void UpdatePosture(_SourceItemData item, bool toSelect, bool isInitial)
    {
        AnimationClipEx postureData = GetPostureData(item);

        if (postureData == null)
        {
            Debug.Log("The AnimationClipEx is NULL!!!");
            return;
        }

        Debug.Log("Clip is " + (postureData.animationClip == null) + "?\n" + postureData.ToString());

        ///Show
        if (toSelect)
        {
//			Debug.Log ("Accessory Selected !");
            if (postureData == currentPoseClip)
            {
//				Debug.Log ("There must be something wrong!");
                return;
            }
            else
            {
                if (isInitial)
                {
                    initialPoseClip = postureData;
//					Debug.Log (item.title + "Set Posture to default");
                }

                currentPoseClip = postureData;
            }

            ///Hide
        }
        else
        {
//			Debug.Log ("Accessory Reselesed !");
            if (postureData == currentPoseClip)
            {
                currentPoseClip = initialPoseClip;
            }
            else
            {
//				Debug.Log ("There must be something else wrong!");
            }
        }

//		UpdateAnimationClip(currentPoseClip);
    }
Ejemplo n.º 12
0
    public void UpdatePosture(_SourceItemData item, bool toSelect, bool isInitial)
    {
//		AnimationClipEx postureData = GetPostureData(item);

        int poseData = GetPostureData(item);

//		if(postureData == null){
//			Debug.Log ("The AnimationClipEx is NULL!!!");
//			return;
//		}

//		Debug.Log ("Clip is " + (postureData.animationClip == null) +"?\n" + postureData.ToString());

        ///Show
        if (toSelect)
        {
            //			Debug.Log ("Accessory Selected !");
            if (curtPoseIndex == poseData)
            {
                //				Debug.Log ("There must be something wrong!");
                return;
            }
            else
            {
                if (isInitial)
                {
                    initPoseIndex = poseData;
                }
                curtPoseIndex = poseData;
            }

            ///Hide
        }
        else
        {
            //			Debug.Log ("Accessory Reselesed !");
            if (curtPoseIndex == poseData)
            {
                curtPoseIndex = initPoseIndex;
            }
            else
            {
                //				Debug.Log ("There must be something else wrong!");
            }
        }

//		UpdateAnimationClip(currentPoseClip);
        UpdatePosture(curtPoseIndex);
    }
Ejemplo n.º 13
0
    GameObject GetItemObject(_SourceItemData item, string name)
    {
        GameObject itemObj;        // = itemObjTable[item];

        //-------------------------------------------------------------
        if (itemObjTable == null)
        {
            itemObjTable = new Dictionary <_SourceItemData, GameObject>();
        }

        if (!itemObjTable.ContainsKey(item))        //.title + name)){// || !itemObjTable[item.title + name]
        {
            AssetBundle ab = AssetBundle.CreateFromFile(item.isTempLoaded ? item.TempLocalPath : item.DecorationLocalPath);
            if (string.IsNullOrEmpty(name))
            {
                itemObj = Instantiate(ab.mainAsset) as GameObject;
            }
            else
            {
                itemObj = Instantiate(ab.Load(name)) as GameObject;
            }

            itemObj.transform.SetParent(transform);
            itemObj.transform.localPosition = defaultObj.transform.localPosition;
            itemObj.transform.localRotation = defaultObj.transform.localRotation;
            itemObj.SetActive(false);
            itemObjTable.Add(item, itemObj);
            ab.Unload(false);
        }
        else
        {
            itemObj = itemObjTable[item];
        }
        //-------------------------------------------------------------
//		AssetBundle ab = AssetBundle.CreateFromFile(item.isTempLoaded ? item.TempLocalPath : item.DecorationLocalPath);
//		if(name.Equals(string.Empty) || name.Equals(""))
//			itemObj = Instantiate(ab.mainAsset) as GameObject;
//		else
//			itemObj = Instantiate(ab.Load (name)) as GameObject;
//
//		itemObj.transform.parent = transform;
//		itemObj.SetActive(false);
//
//		ab.Unload(false);
        //-------------------------------------------------------------
        return(itemObj);
    }
Ejemplo n.º 14
0
    public void HandleOnUpdateAccessory(_SourceItemData item, bool toSelect, bool isPlayable)
    {
        Vector3 curAngles = transform.eulerAngles;

        GetComponent <_RotatController>().BackToInitPoint();
        Current.UpdateAccessory(item, toSelect, isPlayable, false);
        transform.eulerAngles += curAngles;

//         Debug.Log( string.Format("initAvatorData ID IsNullOrEmpty : {0}, AvatorID IsNullOrEmpty :{1};",
//             string.IsNullOrEmpty(initAvatorData.id), string.IsNullOrEmpty(AvatorID)));
//         Debug.Log(string.Format("This is new ? : {0}", IsNew));
//         Debug.Log(string.Format("This is Edited ? : {0}", IsEdited));
//         Debug.Log("\n-----------------IPHONE--------------------\n");
//         Debug.Log(currentAvatorData.ToString());
//         Debug.Log("\n-----------------ANDROID--------------------\n");
//         Debug.Log(JsonWriter.Serialize(currentAvatorData));
    }
Ejemplo n.º 15
0
    public _SourceItemData Find(Predicate <_SourceItemData> match)
    {
        _SourceItemData dest = null;

        foreach (_SourceMenuData menu in data)
        {
            dest = menu.Find(match);
            if (dest != null)
            {
                break;
            }
        }
        if (dest != null)
        {
            return(dest);
        }
        return(_SourceItemData.NullItemData());
    }
Ejemplo n.º 16
0
    private void HandleOnUpdateDance(_SourceItemData item, bool toSelect)
    {
        if (toSelect)
        {
            if (isDance)
            {
                DoPose();
            }

            DoDance(item.id);

            /*DoIdleAnimation();*/
        }
        else
        {
            DoPose();
        }
    }
Ejemplo n.º 17
0
    public void UpdatePosture(_SourceItemData item, bool toSelect, bool isInitial)
    {
        _PostureData postureData = GetPostureData(item);

        if (postureData == null)
        {
            return;
        }

        if (isInitial)
        {
            initialPose = postureData;
            /*Debug.Log (item.title + "Set Posture to default");*/
        }

        ///Show
        if (toSelect)
        {
            /*Debug.Log ("Accessory Selected !");*/
            if (postureData == currentPose)
            {
                Debug.Log("There must be something wrong!");
                return;
            }
            else
            {
                currentPose = postureData;
            }

            ///Hide
        }
        else
        {
            /*Debug.Log ("Accessory Reselesed !");*/
            if (postureData == currentPose)
            {
                currentPose = initialPose;
            }
            else
            {
                Debug.Log("There must be something else wrong!");
            }
        }
    }
//
    void DownloadDefaultData(_SourceItemData item)
    {
        //string saveDefaultPath = Application.dataPath + "/StreamingAssets/LocalDatabase/";

        //		Debug.Log("Asset URL: " + item.PlatformDecoFile);//.decorationfile);

        StartCoroutine(new WWWProxy()
        {
            //			waitTime = 5.0f,
            url      = item.logoFile,
            feedback = delegate(WWW www){
                _InternalDataCodec.SaveTexture(_DafultDataFilePath + "UI/" + item.title + ".png", www.texture, true);
                //				item.isUIImageLoaded = true;
//				item.UIImageLocalPath = _DafultDataFilePath + "UI/" + item.title + ".png";
//				item.isUIImageLoaded = true;



//				SaveDefaultConfigTable();
                _InternalDataCodec.SaveString(JsonFx.Json.JsonWriter.Serialize(tempConfigTable), _DefaultJsonFilePath);
                //				_InternalDataCodec.SaveSerializableData<string>(WriteFileTool.ClassToJson<_ConfigTable>(defaultConfigTable),
                //				                                                Application.dataPath + "/Resources/default_config_json.txt");
            }
        }.WaitForFinished());

        StartCoroutine(new WWWProxy()
        {
            //			waitTime = 5.0f,
            url      = isIOSPlatform ? item.decorationfile_ios : item.decorationfile,       //.
            feedback = delegate(WWW www){
                _InternalDataCodec.SaveBytes(_DafultDataFilePath + "Asset/" + item.title + ".unity3d", www.bytes);
                //				item.isDecorationLoaded = true;
                //item.DecorationLocalPath = _DafultDataFilePath + "Asset/" + item.title + ".unity3d";

                //				item.State = itemState.notSelect;

//				SaveDefaultConfigTable();
                _InternalDataCodec.SaveString(JsonFx.Json.JsonWriter.Serialize(tempConfigTable), _DefaultJsonFilePath);
                //				_InternalDataCodec.SaveSerializableData<string>(WriteFileTool.ClassToJson<_ConfigTable>(defaultConfigTable),
                //				                                                Application.dataPath + "/Resources/default_config_json.txt");
            }
        }.WaitForFinished());
    }
Ejemplo n.º 19
0
    void OnUpdateHands(_SourceItemData handItem, bool toSelect, bool isInitial)
    {
        if (handItem == null || !handItem.typeCode.Equals("righthand"))
        {
            return;
        }

        /* Debug.Log("Hand id : ---> " + handItem.id);*/

        if (!handItem.isDefault)
        {
            OnDefaultHands();
            return;
        }

        posture.UpdatePosture(handItem, toSelect, isInitial);
        /*postureHandler.UpdatePosture(handIitem, true, true);*/
        rightHand.UpdateItem(handItem, "right_hand", toSelect, isInitial);
        leftHand.UpdateItem(handItem, "left_hand", toSelect, isInitial);
    }
Ejemplo n.º 20
0
//	public _SourceItemData Find(_SourceItemData item){
//		_SourceItemData dest = null;
//		if(this.hasChildrenMenu){
//			foreach(_SourceMenuData subMenu in children){
//				dest = subMenu.Find(item);
//				if(dest != null)
//					break;
//			}
//		}else{
//			dest = data.Find( (x) => x.Equals(item));
//		}
//		return dest;
//	}

    public _SourceItemData Find(Predicate <_SourceItemData> match)
    {
        _SourceItemData dest = null;

        if (this.hasChildrenMenu)
        {
            foreach (_SourceMenuData subMenu in children)
            {
                dest = subMenu.Find(match);
                if (dest != null)
                {
                    break;
                }
            }
        }
        else
        {
            dest = data.Find(match);
        }
        return(dest);
    }
Ejemplo n.º 21
0
    _PostureData GetPostureData(_SourceItemData item)
    {
        _PostureData postureData;

        if (!poseTable.ContainsKey(item))
        {
            AssetBundle ab = AssetBundle.CreateFromFile(item.isTempLoaded ? item.TempLocalPath : item.DecorationLocalPath);
            TextAsset   ta = ab.Load("pose") as TextAsset;

            postureData = JsonFx.Json.JsonReader.Deserialize <_PostureData>(ta.text);
            /*Debug.Log ("######### posture Data count : " + postureData.data.Count);*/
            if (postureData != null)
            {
                poseTable.Add(item, postureData);
            }

            ab.Unload(false);
        }
        else
        {
            postureData = poseTable[item];
        }
        return(postureData);
    }
Ejemplo n.º 22
0
    public void OnInitial(List <_SourceItemData> itemList)
    {
        OnDefault();

        if (posture.enabled)
        {
            posture.Back_T_Pose();
        }

        _SourceItemData hatItem = itemList.Find(x => x.typeCode == "hat");

        hat.UpdateItem(hatItem, true, true);

        _SourceItemData glassesItem = itemList.Find(x => x.typeCode == "glasses");

        glasses.UpdateItem(glassesItem, true, true);

        _SourceItemData EyeringsItem = itemList.Find(x => x.typeCode == "earrings");

        eyerings.UpdateItem(EyeringsItem, true, true);

        _SourceItemData HairItem = itemList.Find(x => x.typeCode == "hair");

        hair.UpdateItem(HairItem, true, true);

        _SourceItemData bowsItem = itemList.Find(x => x.typeCode == "brows");

        brow.UpdateItem(bowsItem, true, true);

        _SourceItemData eyesItem = itemList.Find(x => x.typeCode == "eyes");

        eye.UpdateItem(eyesItem, true, true);

        _SourceItemData mouthItem = itemList.Find(x => x.typeCode == "mouth");

        mouth.UpdateItem(mouthItem, true, true);

        _SourceItemData upperItem = itemList.Find(x => x.typeCode == "upper");

        upper.UpdateItem(upperItem, true, true);

        _SourceItemData handIitem = itemList.Find(x => x.typeCode == "righthand");

        //      posture.UpdatePosture(handIitem, true, true);
        //      /*postureHandler.UpdatePosture(handIitem, true, true);*/
        //      rightHand.UpdateItem(handIitem, "right_hand", true, true);
        //      leftHand.UpdateItem(handIitem, "left_hand", true, true);
        OnUpdateHands(handIitem, true, true);

        _SourceItemData bottomItem = itemList.Find(x => x.typeCode == "bottom");

        bottom.UpdateItem(bottomItem, true, true);

        _SourceItemData footsItem = itemList.Find(x => x.typeCode == "foots");

        rightFoot.UpdateItem(footsItem, "right_foot", true, true);
        leftFoot.UpdateItem(footsItem, "left_foot", true, true);

        BuildSkinnedMesh();

        /*postureHandler.SetCurPosture(true);*/

        if (posture.enabled)
        {
            posture.SetCurPosture();
        }
    }
Ejemplo n.º 23
0
 private void HandleOnUpdateWallpaper(_SourceItemData item, bool toSelect)
 {
     Debug.Log("Wallpaper HandleOnUpdateWallpaper");
     Debug.Log(string.Format("Item is {0}, WallpaperLoader is {1}", (item == null), (wallpaperLoader == null)));
     wallpaperLoader.UpdateItem(item, toSelect, false);
 }
Ejemplo n.º 24
0
    public void UpdateItem(_SourceItemData item, string subName, bool toSelect, bool isInitial)
    {
        if (item == null || item.IsNull())
        {
            OnDefault();
            return;
        }

        Debug.LogError("ITEM_REMARK : " + item.remark);
        ///Show
        if (toSelect)
        {
            Debug.Log(item.title + " is Selected !");
//			_InternalDataManager.Instance.AppendLog(item.title + "Accessory Selected ! \n");
            if (item == currentItem)
            {
                Debug.Log(item.title + "toSelect must be something wrong!");
                return;
            }
            else
            {
                GameObject itemObj = GetItemObject(item, subName);

                if (!itemObj)
                {
                    return;
                }

                if (isInitial)
                {
                    initialObj  = itemObj;
                    initialItem = item;

                    if (!initialItem.isHide)
                    {
                        initialItem.isHide = true;
                    }
                }

                if (currentObj)
                {
                    currentObj.SetActive(false);
                }
                currentObj  = itemObj;
                currentItem = item;
            }

            ///Hide
        }
        else
        {
            Debug.Log("Accessory Reselesed !");
//			_InternalDataManager.Instance.AppendLog(item.title + "Accessory Reselesed !! \n");
            if (item == currentItem)
            {
//				itemObj.SetActive(false);
                currentObj.SetActive(false);
                currentObj  = initialObj;
                currentItem = initialItem;
            }
            else
            {
                Debug.Log("There must be something else wrong!");
                //				currentObj.SetActive(false);
                //				currentObj = itemObj;
            }
        }
        //
        currentObj.SetActive(true);
        //PrintBoneWeightInfo(currentObj, currentItem);
//		_InternalDataManager.Instance.AppendLog(item.title + "Accessory SetActive !! \n");
    }
Ejemplo n.º 25
0
 public void UpdateItem(_SourceItemData item, bool toSelect, bool isInitial)
 {
     UpdateItem(item, string.Empty, toSelect, isInitial);
 }
Ejemplo n.º 26
0
 public void StoreHandsItemAndSetToDefault()
 {
     Debug.Log("Avatar Do Default Hands.");
     lastHandsItem = rightHand.ItemData;
     OnDefaultHands();
 }
Ejemplo n.º 27
0
    public IEnumerator OnInitialAvator(string avatorJsonData)
    {
        while (!IsLoaded)
        {
            yield return(new WaitForFixedUpdate());
        }

        Debug.Log("_Hero.OnInitialAvator(string):IEnumerator");

        Debug.Log("Avatar Json String :" + avatorJsonData);

        LoadingView.Instance.OnStart(Color.white, 10F
                                     ,
                                     null,
                                     () => {
            OnInitialAvator();
        }
                                     );

        if (string.IsNullOrEmpty(avatorJsonData))
        {
            OnInitialAvator();
            Debug.Log("OnInitialAvator()...");
            yield return(null);
        }

        initAvatorData = JsonReader.Deserialize <_AvatorData>(avatorJsonData);



        if (initAvatorData == null || initAvatorData.decorationlist == null || initAvatorData.decorationlist.Count == 0 ||
            string.IsNullOrEmpty(initAvatorData.name))
        {
            /*initAvatorData = LoadPlayerPrefs();*/
            /*initAvatorData = defaultAvatorData;*/
            OnInitialAvator();
            yield return(null);
        }

        Debug.Log("Deserialize >>> Avator Data ToString() :" + initAvatorData.ToString());

        AvatorID   = initAvatorData.id;
        AvatorName = initAvatorData.name;



        List <_SourceItemData> itemList = new List <_SourceItemData>();

        foreach (_SourceItemData item in _InternalDataManager.Instance.localConfigTable.FindAll(x => x.isSelected))
        {
            item.isSelected = false;
        }

        for (int i = 0; i < initAvatorData.decorationlist.Count; i++)
        {
            _SourceItemData item = initAvatorData.decorationlist[i];

            if (item == null)
            {
                //nullIndices.Add (i);//nitAvatorData.decorationlist.IndexOf(item));
                continue;
            }

            if (!item.isDefault)             //This is the famous 'bool true = false!!!'.LOL
            //startIndices.Add (i);//nitAvatorData.decorationlist.IndexOf(item));
            {
                continue;
            }



            _SourceItemData dest = _InternalDataManager.Instance.localConfigTable.Find(x => x.id == item.id);

            if (!dest.IsNull())
            {
                Debug.Log("OnInitial : " + dest.typeCode + " : " + dest.title);

                if (!dest.isDecorationLoaded)
                {
                    Debug.Log(dest.title + " is NOT Loaded!" + dest.PlatformDecoFile);

                    if (string.IsNullOrEmpty(dest.PlatformDecoFile))
                    {
                        //nullIndices.Add (i);//nitAvatorData.decorationlist.IndexOf(item));
                        continue;
                    }

                    /*_InternalDataManager.Instance.DownloadItemAsset(dest);*/
                    StartCoroutine(dest.WaitForDownloadAsset());

                    while (!dest.isDecorationLoaded)
                    {
                        yield return(new WaitForFixedUpdate());
                    }
                }
                itemList.Add(dest);
            }
            else
            {
                _SourceItemData temp = _InternalDataManager.Instance.localConfigTable.Find(x => x.title == item.title);
                if (!temp.IsNull())
                {
                    Debug.Log(temp.title + "'s Temp Asset is NOT Loaded!" + temp.PlatformDecoFile);

                    if (string.IsNullOrEmpty(temp.PlatformDecoFile))
                    {
                        //nullIndices.Add (i);//nitAvatorData.decorationlist.IndexOf(item));
                        continue;
                    }

                    /*_InternalDataManager.Instance.DownloadTempAsset(temp);*///, item.PlatformDecoFile);//.decorationfile);

                    StartCoroutine(temp.WaitForDownloadTemp());

                    while (!temp.isTempLoaded)
                    {
                        yield return(new WaitForFixedUpdate());
                    }

                    itemList.Add(temp);
                }
            }
        }

        //		foreach(int i in nullIndices){
        //			initAvatorData.decorationlist.RemoveAt(i);
        //		}

        //		for(int i = 0; i<startIndices.Count; i++){
        //			initAvatorData.decorationlist[startIndices[i]].isHide = true;
        //		}


        foreach (_SourceItemData item in itemList)
        {
            Debug.Log("Item TItle : " + item.title);
            item.isHide = true;
        }


        Current.OnInitial(itemList);



        /*yield return GetComponent<WallpaperHandler>().OnInitialWallpaper(WallpaperIndex);*/

        _SourceItemData wallpaperItem = _InternalDataManager.Instance.localConfigTable.Find(x => x.id == initAvatorData.wallpaperIndex);

        if (!wallpaperItem.IsNull())
        {
            if (!wallpaperItem.isDecorationLoaded)
            {
                Debug.Log(wallpaperItem.title + " is NOT Loaded!" + wallpaperItem.PlatformDecoFile);

                if (string.IsNullOrEmpty(wallpaperItem.PlatformDecoFile))
                {
                    //nullIndices.Add (i);//nitAvatorData.decorationlist.IndexOf(item));
                    //continue;
                    /*_InternalDataManager.Instance.DownloadItemAsset(dest);*/
                }
                StartCoroutine(wallpaperItem.WaitForDownloadAsset());

                while (!wallpaperItem.isDecorationLoaded)
                {
                    yield return(new WaitForFixedUpdate());
                }
            }
            GetComponent <WallpaperHandler>().OnUdateWallpaper(wallpaperItem, true, true);
        }
        else
        {
            initAvatorData.wallpaperIndex = 0;
            GetComponent <WallpaperHandler>().OnDefault();
        }

        _UIController.Instance.ShowMainView();

        LoadingView.Instance.OnFinish();

//         Debug.Log(string.Format("This is new ? : {0}", IsNew));
//         Debug.Log(string.Format("This is Edited ? : {0}", IsEdited));

        yield return(null);
    }
Ejemplo n.º 28
0
    public void UpdateItem(_SourceItemData item, string subName, bool toSelect, bool isInitial)
    {
        if (item == null)
        {
            return;
        }

        ///Show
        if (toSelect)
        {
            Debug.Log(item.title + " is Selected !");
            //			_InternalDataManager.Instance.AppendLog(item.title + "Accessory Selected ! \n");
            if (item == currentItem)
            {
                Debug.Log(item.title + "toSelect must be something wrong!");
                return;
            }
            else
            {
                GameObject itemObj = GetItemObject(item, subName);

                if (!itemObj)
                {
                    return;
                }

                if (isInitial)
                {
                    initObj  = itemObj;
                    initItem = item;

                    if (!initItem.isHide)
                    {
                        initItem.isHide = true;
                    }
                    //					if(initItem != null)
                    //						_InternalDataManager.Instance.localConfigTable.Find(x => x.title == initItem.title).isHide = true;
                    //initItem.isHide = true;
                    //					Debug.Log ("Refesh default");
                }

                if (currentObj)
                {
                    currentObj.SetActive(false);
                }
                currentObj  = itemObj;
                currentItem = item;
            }

            ///Hide
        }
        else
        {
            Debug.Log("Accessory Reselesed !");
            //			_InternalDataManager.Instance.AppendLog(item.title + "Accessory Reselesed !! \n");
            if (item == currentItem)
            {
                //				itemObj.SetActive(false);
                currentObj.SetActive(false);
                currentObj  = initObj;
                currentItem = initItem;
            }
            else
            {
                Debug.Log("There must be something else wrong!");
                //				currentObj.SetActive(false);
                //				currentObj = itemObj;
            }
        }
        //
        currentObj.SetActive(true);
        //		_InternalDataManager.Instance.AppendLog(item.title + "Accessory SetActive !! \n");
    }
Ejemplo n.º 29
0
    /// <summary>
    /// Updates the accessory.
    /// 分发 配饰更新 事件
    /// </summary>
    /// <param name="type">Type.</param>
    /// <param name="id">Identifier.</param>
    /// <param name="isPlayable">If set to <c>true</c> is playable.</param>
    public void UpdateAccessory(_SourceItemData item, bool toSelect = true, bool isPlayable = true, bool isInitial = false)
    {
//		if(posture == null)
//			posture = GetComponent<_Posture>();

        if (posture.enabled)
        {
            posture.Back_T_Pose();
        }

        switch (item.typeCode)
        {
        case "hat":
            hat.UpdateItem(item, toSelect, isInitial);
            break;

        case "glasses":
            glasses.UpdateItem(item, toSelect, isInitial);
            break;

        case "earrings":
            eyerings.UpdateItem(item, toSelect, isInitial);
            break;

        case "hair":
            hair.UpdateItem(item, toSelect, isInitial);
            break;

        case "brows":
            brow.UpdateItem(item, toSelect, isInitial);
            break;

        case "eyes":
            eye.UpdateItem(item, toSelect, isInitial);
            break;

        case "mouth":
            mouth.UpdateItem(item, toSelect, isInitial);
            break;

        case "upper":
            upper.UpdateItem(item, toSelect, isInitial);
            break;

        case "righthand":
            OnUpdateHands(item, toSelect, isInitial);
            break;

        case "bottom":
            bottom.UpdateItem(item, toSelect, isInitial);
            break;

        case "foots":
            leftFoot.UpdateItem(item, "left_foot", toSelect, isInitial);
            rightFoot.UpdateItem(item, "right_foot", toSelect, isInitial);
            break;

        default:
            break;
        }

        BuildSkinnedMesh();

//		combineMeshAndAcceObj.GetComponent<Animator>().Play(0);

        /*postureHandler.SetCurPosture(true);*/

        if (posture.enabled)
        {
            posture.SetCurPosture();
        }

        //		posture.SetCurPosture(upper.currentObj);
    }
/*
 *      void DownloadItemUI(_SourceItemData item){
 *
 * //		string uiLocalPath = Path.Combine(_LocalUIDirectory , item.title + ".png");
 *              //return Path.Combine(_InternalDataManager.Instance._LocalUIDirectory, title + ".png");
 *              StartCoroutine(new WWWProxy(){
 *
 *                      url = item.logoFile,
 *                      feedback = delegate(WWW www){
 *                              _InternalDataCodec.SaveTexture(item.UIImageLocalPath, www.texture, true);
 * //				item.isUIImageLoaded = true;
 * //				item.UIImageLocalPath = uiLocalPath;
 * //				SaveLocalConfigTable();
 *
 *                      }}.WaitForFinished());
 *
 *      }*/

    /*public void DownloadItemAsset(_SourceItemData item)
     * {
     * //		string assetLocalPath = Path.Combine(_LocalAssetDirectory ,item.title + ".unity3d");
     *
     * //		Debug.Log ("Asset Local Path : " + assetLocalPath);
     *
     *      StartCoroutine(new WWWProxy(){
     *              url = item.PlatformDecoFile,//.decorationfile,
     *              feedback = delegate(WWW www){
     *
     *                      _InternalDataCodec.SaveBytes(item.DecorationLocalPath, www.bytes);
     * //				item.DecorationLocalPath = assetLocalPath;
     * //				SaveLocalConfigTable();
     *
     *              }}.WaitForFinished());
     * }*/

    /*public void DownloadTempAsset(_SourceItemData item)//, string tempAssetUrl)
     * {
     * //		string assetLocalPath = Path.Combine(_LocalTempDirectory ,item.title + ".unity3d");
     *
     *      StartCoroutine(new WWWProxy(){
     *              url = item.PlatformDecoFile,//tempAssetUrl,
     *              feedback = delegate(WWW www){
     *
     *                      _InternalDataCodec.SaveBytes(item.TempLocalPath, www.bytes);
     * //				item.TempLocalPath = assetLocalPath;
     * //				SaveLocalConfigTable();
     *
     *              }}.WaitForFinished());
     * }*/

    public void DeleteTempAsset(_SourceItemData item)
    {
        _InternalDataCodec.DeleteLocalData(item.TempLocalPath);
//		item.TempLocalPath = string.Empty;
        SaveLocalConfigTable();
    }