Beispiel #1
0
    public void GotoMake(TattooData td)
    {
        main.SetActive(false);
        popupMake.SetActive(true);

        popupMake.GetComponent <UITattooMake>().ChooseTattoo(td);
    }
    public void DisplayTattooInfo(string tattooID)
    {
        ItemData itemData = DataManager.Instance.GetItemData(tattooID);

        TattooData td = DataManager.Instance.GetTattooData(itemData.id);

        icon.mainTexture = InJoy.AssetBundles.AssetBundles.Load(itemData.iconPath) as Texture2D;

        labelName.text = td.GetDisplayName();

        labelBearPoint.text = td.bearingPoint.ToString();

        labelPos.text = Utils.GetTattooApplicablePositions(td.applicableParts);

        labelEffect.text = DataManager.Instance.GetItemAttributesDisplay(itemData);

        if (string.IsNullOrEmpty(td.suiteID))
        {
            labelSuiteEffect.text = string.Empty;
        }
        else
        {
            labelSuiteEffect.text = Localization.instance.Get(DataManager.Instance.GetTattooSuiteData(td.suiteID).descIDS);
        }
    }
Beispiel #3
0
    void CheckBearPoint()
    {
        ItemInventory ii = null;

        if (PlayerInfo.Instance.playerTattoos.tattooDict.ContainsKey(_caller.SelectedPart))
        {
            ii = PlayerInfo.Instance.playerTattoos.tattooDict[_caller.SelectedPart];
        }

        TattooData oldTD = null;

        if (ii != null)
        {
            oldTD = DataManager.Instance.GetTattooData(ii.ItemID);
        }

        if (PlayerInfo.Instance.CanBearTattoo(this.ttData, oldTD))
        {
            labelBearPoint.color = Color.white;
            _canBear             = true;
        }
        else
        {
            labelBearPoint.color = Color.red;
            _canBear             = false;
        }
    }
    public void Initialize()
    {
        if (_recipeItemList == null)
        {
            FillRecipeGrid();
        }

        _selectedTD = null;
    }
Beispiel #5
0
    public void SetData(TattooData data, UITattooMake uiMake)
    {
        _uiMake = uiMake;

        ttData = data;

        HasLearned = PlayerInfo.Instance.playerMasteredTattoos.Contains(data.tattooID);

        DisplayInfo();
    }
Beispiel #6
0
    public void SetData(TattooData data, int amount, UITattooDisenchant caller)
    {
        _caller = caller;

        _amount = amount;

        ttData = data;

        DisplayInfo();
    }
    public void SetData(TattooData data, int amount, UITattooSellRecipe caller)
    {
        _caller = caller;

        _amount = amount;

        ttData = data;

        HasLearned = PlayerInfo.Instance.playerMasteredTattoos.Contains(data.tattooID);

        DisplayInfo();
    }
Beispiel #8
0
    public int GetTattooSuiteBearPoints(TattooSuiteData tsd)
    {
        int sum = 0;

        foreach (string tattooID in tsd.tdList)
        {
            TattooData td = this.GetTattooData(tattooID);

            sum += td.bearingPoint;
        }
        return(sum);
    }
Beispiel #9
0
    public void Initialize(TattooBodySlot slot, string tattooID, UITattoo uiTattoo)
    {
        _uiTattooMain = uiTattoo;

        _slot = slot;

        ItemData itemData;

        TattooData td;

        if (slot == null)               //called from recipe clicking
        {
            itemData = DataManager.Instance.GetItemData(tattooID);

            //show goto button
            buttonGotoMake.SetActive(true);
            buttonReplace.SetActive(false);
            buttonRemove.SetActive(false);
        }
        else
        {
            itemData = slot.item.ItemData;

            buttonGotoMake.SetActive(false);
            buttonReplace.SetActive(true);
            buttonRemove.SetActive(true);
        }

        td = DataManager.Instance.GetTattooData(itemData.id);

        _tattooData = td;

        icon.mainTexture = InJoy.AssetBundles.AssetBundles.Load(itemData.iconPath) as Texture2D;

        labelName.text = Localization.instance.Get(itemData.nameIds);

        labelBearPoint.text = td.bearingPoint.ToString();

        labelPos.text = Utils.GetTattooApplicablePositions(td.applicableParts);

        labelEffect.text = Localization.instance.Get(itemData.descriptionIds);

        if (string.IsNullOrEmpty(td.suiteID))
        {
            labelSuiteEffect.text = string.Empty;
        }
        else
        {
            labelSuiteEffect.text = Localization.instance.Get(DataManager.Instance.GetTattooSuiteData(td.suiteID).descIDS);
        }
    }
Beispiel #10
0
    public bool CanBearTattoo(TattooData newTD, TattooData oldTD)
    {
        int sum = this.BearingPoint;

        int consumed = this.ConsumedBearingPoint;

        if (oldTD == null && consumed + newTD.bearingPoint <= sum ||
            oldTD != null && consumed - oldTD.bearingPoint + newTD.bearingPoint <= sum)
        {
            return(true);
        }

        return(false);
    }
Beispiel #11
0
    public bool HasSufficientMaterials(TattooData td)
    {
        bool result = true;

        foreach (MatAmountMapping mapping in td.materials)
        {
            if (GetItemCount(mapping.materialName) < mapping.amount)
            {
                result = false;
                break;
            }
        }
        return(result);
    }
Beispiel #12
0
    public void SetData(TattooData data, ItemInventory ii, bool isEquipped, UITattooChoose caller)
    {
        ttData = data;

        inventoryItem = ii;

        _isEquipped = isEquipped;

        _caller = caller;

        DisplayInfo();

        CheckBearPoint();
    }
Beispiel #13
0
    public void ChooseTattoo(TattooData td)
    {
        _selectedTD = td;

        float x = recipeGrid.cellHeight * (td.ord + td.level - 1);

        UIRecipeItem recipeItem = _recipeItemList.Find(delegate(UIRecipeItem rcp) { return(!rcp.IsSummaryLine && rcp.ttData.tattooID == td.tattooID); });

        this.SetFocus(recipeItem);

        //select it!
        UIDraggablePanel panel = recipeGrid.transform.parent.GetComponent <UIDraggablePanel>();

        panel.ResetPosition();

        panel.MoveRelative(x * Vector3.up);
    }
Beispiel #14
0
    public List <EnumTattooPart> GetTattooSuiteApplicablePositions(TattooSuiteData tsd)
    {
        List <EnumTattooPart> list = new List <EnumTattooPart>();

        foreach (string tattooID in tsd.tdList)
        {
            TattooData td = this.GetTattooData(tattooID);
            foreach (EnumTattooPart part in td.applicableParts)
            {
                if (!list.Contains(part))
                {
                    list.Add(part);
                }
            }
        }

        return(list);
    }
Beispiel #15
0
    void FillMaterialGrid()
    {
        TattooData ttd = _focusItem.ttData;

        int index = 0;

        //materials
        foreach (MatAmountMapping mapping in ttd.materials)
        {
            UITattooMaterialItem uiItem;

            if (index < _tmList.Count)
            {
                uiItem = _tmList[index];
            }
            else
            {
                GameObject go = NGUITools.AddChild(materialGrid.gameObject, materialItemPrefab);

                uiItem = go.GetComponent <UITattooMaterialItem>();

                _tmList.Add(uiItem);
            }

            uiItem.SetData(mapping.materialName, mapping.amount);

            uiItem.gameObject.SetActive(true);

            index++;
        }

        while (index < _tmList.Count)
        {
            _tmList[index++].gameObject.SetActive(false);
        }

        materialGrid.Reposition();
    }
    public static void Read()
    {
        bool newFile = false;

        TattooDataList dataList = null;

        UnityEngine.Object oldFile = AssetDatabase.LoadAssetAtPath(outFileName, typeof(TattooDataList));
        if (oldFile == null)
        {
            newFile  = true;
            dataList = ScriptableObject.CreateInstance(typeof(TattooDataList)) as TattooDataList;
        }
        else
        {
            dataList = oldFile as TattooDataList;
        }

        dataList.dataList.Clear();

        string jsonStr = File.ReadAllText(fileName);

        JsonHashtable ht = FCJson.jsonDecode(jsonStr) as JsonHashtable;

        foreach (System.Object obj in ht.ValueList)
        {
            Hashtable ht2 = obj as Hashtable;

            TattooData newData = new TattooData();

            newData.tattooID = ht2["tattoo"] as string;
            newData.recipeID = ht2["recipe"] as string;
            newData.suiteID  = ht2["suiteId"] as string;
            newData.ord      = (int)ht2["ord"];

            List <EnumTattooPart> parts = new List <EnumTattooPart>();

            int partsNum = (int)ht2["tattooPart"];

            int shiftTime = 0;

            while (partsNum != 0)
            {
                if ((partsNum & 1) != 0)
                {
                    parts.Add((EnumTattooPart)shiftTime);
                }

                partsNum = partsNum >> 1;

                shiftTime++;
            }

            newData.applicableParts = parts;

            newData.level        = (int)ht2["tattooLevel"];
            newData.bearingPoint = (int)ht2["bearingPoint"];
            newData.learnHC      = (int)ht2["learnCostHC"];
            newData.hcCost       = (int)ht2["costHC"];
            newData.scCost       = (int)ht2["costSC"];

            newData.materials = new List <MatAmountMapping>();

            for (int i = 1; i < 6; i++)
            {
                string fieldMat   = "material" + i.ToString();
                string fieldCount = "count" + i.ToString();

                string materialName = ht2[fieldMat] as string;

                if (string.IsNullOrEmpty(materialName))
                {
                    break;
                }

                newData.materials.Add(new MatAmountMapping(materialName, (int)ht2[fieldCount]));
            }

            dataList.dataList.Add(newData);
        }

        dataList.Sort();

        if (newFile)
        {
            AssetDatabase.CreateAsset(dataList, outFileName);
        }
        else
        {
            EditorUtility.SetDirty(dataList);
        }
        Debug.Log(string.Format("Tattoo data imported OK. {0} records.", dataList.dataList.Count));
    }
    void OnEnable()
    {
        if (null != FCUIInventory.Instance)
        {
            _currentItem        = FCUIInventory.Instance.CurrentSelectionItem;
            itemNameLabel.text  = Localization.Localize(_currentItem.ItemData.nameIds);
            itemNameLabel.color = FCConst.RareColorMapping[(EnumRareLevel)_currentItem.ItemData.rareLevel];
            if (_currentItem.ItemData.type != ItemType.tattoo)
            {
                slot.Item = _currentItem;
            }
            equipLevelValue.Refresh(Localization.Localize("IDS_MESSAGE_ITEMINFO_ITEMLEVEL"), _currentItem.ItemData.level.ToString());
            useLevelValue.Refresh(Localization.Localize("IDS_MESSAGE_ITEMINFO_ITEMENABLELEVEL"), _currentItem.ItemData.enableLevel.ToString());
            fightScore.FS = _currentItem.FS;
            tattooSlot.gameObject.SetActive(false);
            slot.gameObject.SetActive(true);
            costSC.SC = _currentItem.CostSC;
            if (_currentItem.IsEquipment())
            {
                SitchOtherLayout(false);

                itemPartValue.Refresh(Localization.Localize("IDS_MESSAGE_INVENTORY_EQUIPPART"), Localization.Localize(Utils.GetItemPartNamesIDS(_currentItem.ItemData.type, _currentItem.ItemData.subType)));
                fusionLevelValue.Refresh(Localization.Localize("IDS_MESSAGE_ITEMINFO_ITEMFUSIONLEVEL"), _currentItem.CurrentFusionLevel().ToString());
                attribute1.Refresh(_currentItem, 0);
                attribute2.Refresh(_currentItem, 1);
                attribute3.Refresh(_currentItem, 2);
                attribute4.Clear();
                attribute5.Clear();
                attribute6.Clear();
                equipButton.label.text = Localization.Localize("IDS_BUTTON_GLOBAL_EQUIP");
                equipButton.gameObject.SetActive(true);
                fusionButton.label.text = Localization.Localize("IDS_BUTTON_GLOBAL_FUSION");
                fusionButton.gameObject.SetActive(true);

                itemPartValue.gameObject.SetActive(true);
                useLevelValue.gameObject.SetActive(true);
                fusionLevelValue.gameObject.SetActive(true);
                equipLevelValue.gameObject.SetActive(true);
                fightScore.gameObject.SetActive(true);

                //whether the equipment is on body
                if (_currentItem.IsEquiped())
                {
                    equipButton.GetComponent <UIImageButton>().isEnabled = false;
                    sellButton.GetComponent <UIImageButton>().isEnabled  = false;
                }
                else
                {
                    equipButton.GetComponent <UIImageButton>().isEnabled = true;
                    sellButton.GetComponent <UIImageButton>().isEnabled  = true;
                }
                //fusion
                if (null != _currentItem.NextFusionData)
                {
                    fusionButton.GetComponent <UIImageButton>().isEnabled = true;
                }
                else
                {
                    fusionButton.GetComponent <UIImageButton>().isEnabled = false;
                }
            }
            else//not equipment
            {
                SitchOtherLayout(true);

                itemPartValue.Refresh(Localization.Localize("IDS_MESSAGE_ITEMINFO_ITEMTYPE"), Localization.Localize(Utils.GetItemPartNamesIDS(_currentItem.ItemData.type, _currentItem.ItemData.subType)));
                attribute1.Refresh(Localization.Localize(_currentItem.ItemData.descriptionIds));
                attribute2.Clear();
                attribute3.Clear();
                attribute4.Clear();
                attribute5.Clear();
                attribute6.Clear();

                itemPartValue.gameObject.SetActive(true);
                equipLevelValue.gameObject.SetActive(true);
                useLevelValue.gameObject.SetActive(false);
                fusionLevelValue.gameObject.SetActive(false);
                fightScore.gameObject.SetActive(false);

                middleButton.gameObject.SetActive(true);
                otherSellButton.gameObject.SetActive(true);

                //tatoo
                if (_currentItem.ItemData.type == ItemType.tattoo)
                {
                    rightButton.isEnabled = true;
                    rightButton.gameObject.SetActive(true);
                    rightButton.label.text = Localization.Localize("IDS_BUTTON_TATTOO_TATTOODISENCHANT");

                    middleButton.gameObject.SetActive(true);
                    middleButton.label.text = Localization.Localize("IDS_BUTTON_GLOBAL_EQUIP");
                    tattooSlot.tattooItem   = _currentItem;
                    tattooSlot.gameObject.SetActive(true);
                    slot.gameObject.SetActive(false);
                    useLevelValue.gameObject.SetActive(true);
                    fusionLevelValue.gameObject.SetActive(true);
                    TattooData td = DataManager.Instance.GetTattooData(_currentItem.ItemData.id);
                    useLevelValue.Refresh(Localization.Localize("IDS_MESSAGE_TATTOO_TATTOOBEARPOINT")
                                          , td.bearingPoint.ToString());
                    fusionLevelValue.Refresh(Localization.Localize("IDS_MESSAGE_TATTOO_TATTOOPOSITION")
                                             , Utils.GetTattooApplicablePositions(td.applicableParts));
                }//tribute
                else if (_currentItem.ItemData.type == ItemType.tribute)
                {
                    middleButton.gameObject.SetActive(false);

                    rightButton.gameObject.SetActive(true);
                    rightButton.label.text = Localization.Localize("IDS_BUTTON_HUD_TRIBUTE");
                }//recipe
                else if (_currentItem.ItemData.type == ItemType.recipe)
                {
                    middleButton.isEnabled = true;
                    middleButton.gameObject.SetActive(true);
                    middleButton.label.text = Localization.Localize("IDS_BUTTON_TATTOO_ACTIVATION");

                    rightButton.isEnabled = true;
                    rightButton.gameObject.SetActive(true);
                    rightButton.label.text = Localization.Localize("IDS_BUTTON_GLOBAL_EXCHANGE");
                }
                else
                {
                    middleButton.gameObject.SetActive(false);
                    rightButton.gameObject.SetActive(false);
                }
            }
        }
    }
    public void Initialize(EnumTattooPart part, UITattoo uiTattoo)
    {
        OnDisable();

        _selectedPart = part;

        _uiTattoo = uiTattoo;

        //list all tattoos, including those equipped on body
        _ttList = new List <UITattooChooseItem>();

        //tattoos in bag
        List <ItemInventory> bagTTList = PlayerInfo.Instance.PlayerInventory.itemList.FindAll(
            delegate(ItemInventory ii)
        {
            return(ii.ItemData.type == ItemType.tattoo);
        });

        foreach (ItemInventory ii in bagTTList)
        {
            TattooData td = DataManager.Instance.GetTattooData(ii.ItemID);

            if (td.applicableParts.Contains(part))
            {
                GameObject go = NGUITools.AddChild(ttGrid.gameObject, itemPrefab);

                UITattooChooseItem uiItem = go.GetComponent <UITattooChooseItem>();

                uiItem.SetData(td, ii, false, this);

                _ttList.Add(uiItem);
            }
        }

        //tattoos burnt on body
        foreach (KeyValuePair <EnumTattooPart, ItemInventory> kvp in PlayerInfo.Instance.playerTattoos.tattooDict)
        {
            if (kvp.Key != _selectedPart)
            {
                TattooData td = DataManager.Instance.GetTattooData(kvp.Value.ItemID);

                if (td.applicableParts.Contains(part))
                {
                    GameObject go = NGUITools.AddChild(ttGrid.gameObject, itemPrefab);

                    UITattooChooseItem uiItem = go.GetComponent <UITattooChooseItem>();

                    uiItem.SetData(td, kvp.Value, true, this);

                    _ttList.Add(uiItem);
                }
            }
        }

        NGUITools.FindInParents <UIDraggablePanel>(ttGrid.gameObject).ResetPosition();

        ttGrid.repositionNow = true;

        labelTitle.text = string.Format("{0} ({1})", Localization.instance.Get("IDS_BUTTON_GLOBAL_EQUIP"),
                                        Localization.instance.Get(Utils.k_tattoo_part_names[(int)_selectedPart]));

        if (_ttList.Count > 0)
        {
            SetFocus(_ttList[0]);
        }
        else
        {
            buttonOK.gameObject.SetActive(false);
        }
    }