예제 #1
0
 // Public
 public new void SetParam(BaseCell baseCell, BasePanel rootPanel)
 {
     base.SetParam(baseCell, rootPanel);
     if (baseCell is ItemCell)
     {
         ItemCell itemCell = baseCell as ItemCell;
         imageInnerIcon.sprite = Resources.Load <Sprite>("Icons/" + itemCell.item.iconName);
     }
     if (baseCell is EquipCell)
     {
         EquipCell equipCell = baseCell as EquipCell;
         // Check Empty Cell
         if (equipCell.item == null)
         {
             Destroy(gameObject);
             return;
         }
         imageInnerIcon.sprite = Resources.Load <Sprite>("Icons/" + equipCell.item.iconName);
     }
     if (baseCell is SkillCell)
     {
         SkillCell skillCell = baseCell as SkillCell;
         imageInnerIcon.sprite = Resources.Load <Sprite>("Icons/" + skillCell.skill.iconName);
     }
 }
예제 #2
0
    override public void UpdatePanel()
    {
        base.UpdatePanel();
        foreach (PanelEquipCell panelEquipmentCell in equipCellArray)
        {
            EquipCell equipCell = CharacterParam.equipInventory.GetCellByType(panelEquipmentCell.equipType, panelEquipmentCell.count);
            if (equipCell != null)
            {
                panelEquipmentCell.SetParam(equipCell, this);
            }
        }
        // Text Update
        textStrength.text = CharacterParam.abilitys.strength.ToString();
        textAgility.text  = CharacterParam.abilitys.agility.ToString();
        textIntellec.text = CharacterParam.abilitys.intellect.ToString();
        textStamina.text  = CharacterParam.abilitys.stamina.ToString();
        textBody.text     = CharacterParam.abilitys.body.ToString();

        textCrushing.text = CharacterParam.resistance.сrushing.ToString();
        textStabbing.text = CharacterParam.resistance.stabbing.ToString();
        textCutting.text  = CharacterParam.resistance.cutting.ToString();
        textArrow.text    = CharacterParam.resistance.arrow.ToString();
        textFire.text     = CharacterParam.resistance.fire.ToString();
        textWhoter.text   = CharacterParam.resistance.water.ToString();
        textEarth.text    = CharacterParam.resistance.earth.ToString();
        textAir.text      = CharacterParam.resistance.air.ToString();
        textDeath.text    = CharacterParam.resistance.death.ToString();
        textPoison.text   = CharacterParam.resistance.poison.ToString();
    }
예제 #3
0
    // Constructor
    public EquipInventory()
    {
        EquipCell equipCell = null;

        listEqupCells       = new List <EquipCell>();
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.AMULET;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.ARMOR;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.BELT;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.BOOTS;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.CLOAK;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.GLOVES;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.HELMET;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.PANTS;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.PET;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.RING;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.RING;
        equipCell.count     = 1;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.WEAPON;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.WEAPON;
        equipCell.count     = 1;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.TOOL;
        equipCell.count     = 0;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.TOOL;
        equipCell.count     = 1;
        listEqupCells.Add(equipCell);
        equipCell           = new EquipCell();
        equipCell.equipType = BaseItem.ItemType.TOOL;
        equipCell.count     = 2;
        listEqupCells.Add(equipCell);
    }
예제 #4
0
    private void EquipItemFromICharacterInventory(DragAndDropParam dragAndDropParam)
    {
        EquipCell equipCell = dragAndDropParam.dragCell as EquipCell;
        ItemCell  itemCell  = dragAndDropParam.dropCell as ItemCell;

        equipCell.item = itemCell.item;
        CharacterParam.itemInventory.RemoveItem(itemCell.item);
        // Update Chaeacre Param
        CharacterParam.UpadateParam(itemCell.item);
        // Update All Panels
        UIBuilder.UpdateAllPanels();
    }
예제 #5
0
 // Public
 public void SetParam(EquipCell equipCell, BasePanel rootPanel)
 {
     base.SetParam(equipCell, rootPanel);
     if (equipCell.item == null)
     {
         imageInnerIcon.gameObject.SetActive(false);
         imageTypeIcon.gameObject.SetActive(true);
     }
     else
     {
         imageInnerIcon.gameObject.SetActive(true);
         imageTypeIcon.gameObject.SetActive(false);
         EquipCell cell = CharacterParam.equipInventory.GetCellByType(equipType, count);
         imageInnerIcon.sprite = Resources.Load <Sprite>("Icons/" + cell.item.iconName);
     }
 }
예제 #6
0
    private void EquipItemFromIBoxInventory(DragAndDropParam dragAndDropParam)
    {
        EquipCell equipCell = dragAndDropParam.dragCell as EquipCell;
        ItemCell  itemCell  = dragAndDropParam.dropCell as ItemCell;

        equipCell.item = itemCell.item;
        PanelBoxInventory panelBoxInventory = dragAndDropParam.dragFromPanel.GetComponent <PanelBoxInventory>();

        panelBoxInventory.sceneObject.GetItemInventory().RemoveItem(itemCell.item);
        // Update Character Param
        CharacterParam.UpadateParam(itemCell.item);
        // Update Box Inventory Panel
        panelBoxInventory.UpdatePanel(panelBoxInventory.sceneObject);
        // Update All Panels
        UIBuilder.UpdateAllPanels();
    }
예제 #7
0
    private void UnEquipItemToCharacterInventory(DragAndDropParam dragAndDropParam)
    {
        EquipCell equipCell = dragAndDropParam.dropCell as EquipCell;
        ItemCell  itemCell  = dragAndDropParam.dropCell as ItemCell;

        if (itemCell != null)
        {
            Debug.Log("Drop to stuck");
        }
        else
        {
            CharacterParam.itemInventory.AddItem(equipCell.item);
            // Update Character Param
            CharacterParam.UpadateParam(equipCell.item);
            equipCell.item = null;
        }
        // Update All Panels
        UIBuilder.UpdateAllPanels();
    }
예제 #8
0
    private void UnEquipItemToBoxInventory(DragAndDropParam dragAndDropParam)
    {
        EquipCell         equipCell         = dragAndDropParam.dropCell as EquipCell;
        ItemCell          itemCell          = dragAndDropParam.dropCell as ItemCell;
        PanelBoxInventory panelBoxInventory = dragAndDropParam.dragToPanel.GetComponent <PanelBoxInventory>();

        if (itemCell != null)
        {
            Debug.Log("Drop to stuck");
        }
        else
        {
            panelBoxInventory.sceneObject.GetItemInventory().AddItem(equipCell.item);
            // Update Character Param
            CharacterParam.UpadateParam(equipCell.item);
            equipCell.item = null;
        }
        // Update Box Inventory Panel
        panelBoxInventory.UpdatePanel(panelBoxInventory.sceneObject);
        // Update All Panels
        UIBuilder.UpdateAllPanels();
    }
예제 #9
0
 private void ActionCellDrop(DragAndDropParam dragAndDropParam)
 {
     // Stop Prev Action
     StopAllCoroutines();
     /// Hot Bar
     if (dragAndDropParam.dragToPanel != null &&
         dragAndDropParam.dragToPanel.panelName == "PanelHotBar")
     {
         // Drop Cell
         if (dragAndDropParam.dropCell == null)
         {
             return;
         }
         // Create Action
         StartCoroutine(StartAction(0, dragAndDropParam, this.DropCellToHotBar));
     }
     /// Equip from Character Inventory
     if (dragAndDropParam.dragToPanel != null &&
         dragAndDropParam.dragToPanel.panelName == "PanelCharacter" &&
         dragAndDropParam.dragFromPanel != null &&
         dragAndDropParam.dragFromPanel.panelName == "PanelCharacterInventory")
     {
         if (dragAndDropParam.dropCell is EquipCell)
         {
             // Drop Cell
             if (dragAndDropParam.dropCell == null ||
                 dragAndDropParam.dropCell.baseCell != null)
             {
                 return;
             }
             EquipCell equipCell = dragAndDropParam.dropCell as EquipCell;
             ItemCell  itemCell  = dragAndDropParam.dragCell as ItemCell;
             // Cell Not Empty
             if (equipCell.equipType != itemCell.item.itemType ||
                 equipCell.item != null)
             {
                 return;
             }
             // Create Action
             StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.EquipItemFromICharacterInventory));
         }
     }
     /// Equip from Box Inventory
     if (dragAndDropParam.dragToPanel != null &&
         dragAndDropParam.dragToPanel.panelName == "PanelCharacter" &&
         dragAndDropParam.dragFromPanel != null &&
         dragAndDropParam.dragFromPanel.panelName == "PanelBoxInventory")
     {
         if (dragAndDropParam.dropCell is EquipCell)
         {
             // Drop Cell
             if (dragAndDropParam.dropCell == null ||
                 dragAndDropParam.dropCell.baseCell != null)
             {
                 return;
             }
             EquipCell equipCell = dragAndDropParam.dropCell as EquipCell;
             ItemCell  itemCell  = dragAndDropParam.dragCell as ItemCell;
             // Cell Not Empty
             if (equipCell.equipType != itemCell.item.itemType ||
                 equipCell.item != null)
             {
                 return;
             }
             // Create Action
             StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.EquipItemFromIBoxInventory));
         }
     }
     /// UnEquip to Character Inventory
     if (dragAndDropParam.dragToPanel != null &&
         dragAndDropParam.dragToPanel.panelName == "PanelCharacterInventory" &&
         dragAndDropParam.dragFromPanel != null &&
         dragAndDropParam.dragFromPanel.panelName == "PanelCharacter")
     {
         EquipCell equipCell = dragAndDropParam.dragCell as EquipCell;
         // Full Inventory
         if (!CharacterParam.itemInventory.IsAdd(equipCell.item))
         {
             return;
         }
         StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.UnEquipItemToCharacterInventory));
     }
     /// UnEquip to Box Inventory
     if (dragAndDropParam.dragToPanel != null &&
         dragAndDropParam.dragToPanel.panelName == "PanelBoxInventory" &&
         dragAndDropParam.dragFromPanel != null &&
         dragAndDropParam.dragFromPanel.panelName == "PanelCharacter")
     {
         EquipCell         equipCell         = dragAndDropParam.dragCell as EquipCell;
         PanelBoxInventory panelBoxInventory = dragAndDropParam.dragToPanel.GetComponent <PanelBoxInventory>();
         // Full Inventory
         if (!panelBoxInventory.sceneObject.GetItemInventory().IsAdd(equipCell.item))
         {
             return;
         }
         StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.UnEquipItemToBoxInventory));
     }
     /// Drop from Box Inventory to Character Inventory
     if (dragAndDropParam.dragFromPanel != null &&
         dragAndDropParam.dragFromPanel.panelName == "PanelBoxInventory" &&
         dragAndDropParam.dragToPanel != null &&
         dragAndDropParam.dragToPanel.panelName == "PanelCharacterInventory")
     {
         ItemCell itemCell = dragAndDropParam.dragCell as ItemCell;
         // Full Inventory
         if (!CharacterParam.itemInventory.IsAdd(itemCell.item))
         {
             return;
         }
         StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.DropToCharacterInventoryFromBoxInventory));
     }
     /// Drop from Character Inventory to Box Inventory
     if (dragAndDropParam.dragFromPanel != null &&
         dragAndDropParam.dragFromPanel.panelName == "PanelCharacterInventory" &&
         dragAndDropParam.dragToPanel != null &&
         dragAndDropParam.dragToPanel.panelName == "PanelBoxInventory")
     {
         ItemInventory itemInventory = dragAndDropParam.dragToPanel.GetComponent <PanelBoxInventory>().sceneObject.GetItemInventory();
         ItemCell      itemCell      = dragAndDropParam.dragCell as ItemCell;
         // Full Inventory
         if (!itemInventory.IsAdd(itemCell.item))
         {
             return;
         }
         StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.DropToBoxinventoryFromCharacterInventory));
     }
 }