Пример #1
0
    public void UpdatePanel(BaseSceneObject sceneObject)
    {
        base.UpdatePanel();
        this.sceneObject = sceneObject;
        // Clear Content
        RemoveAllChildren(boxContent);
        ItemInventory itemInventory = null;

        // Set Text
        textCurrentMass.text   = sceneObject.GetItemInventory().GetCurrentMass().ToString();
        textCurrentVolume.text = sceneObject.GetItemInventory().GetCurrentVolume().ToString();
        textMaxMass.text       = sceneObject.GetItemInventory().maxMass.ToString();
        textMaxVolume.text     = sceneObject.GetItemInventory().maxVolume.ToString();
        // Create Inventory Cell
        if (sceneObject is BarrelObject)
        {
            BarrelObject barrelObject = sceneObject as BarrelObject;
            itemInventory = barrelObject.itemInventory;
        }
        if (itemInventory != null)
        {
            foreach (ItemCell itemCell in itemInventory.listItemCells)
            {
                GameObject panelItemCell = Instantiate(itemCellPrefab, boxContent.transform);
                panelItemCell.GetComponent <PanelItemCell>().SetParam(itemCell, this);
            }
        }
    }
Пример #2
0
    static private void GetBaseSceneObject(XmlNode sceneObjectNode,
                                           BaseSceneObject baseSceneObject)
    {
        foreach (XmlNode node in sceneObjectNode.ChildNodes)
        {
            switch (node.Name)
            {
            case "GameName":
                baseSceneObject.sceneObjectGameName = sceneObjectNode.InnerText;
                break;

            case "Description":
                baseSceneObject.description = sceneObjectNode.InnerText;
                break;

            case "IconName":
                baseSceneObject.iconName = sceneObjectNode.InnerText;
                break;

            case "Quality":
                uint.TryParse(sceneObjectNode.InnerText, out baseSceneObject.quality);
                break;

            case "HP":
                uint.TryParse(sceneObjectNode.InnerText, out baseSceneObject.HP);
                break;
            }
        }
    }
Пример #3
0
 // Public
 // Private
 private void OpenTargetPanel(BaseSceneObject sceneObject)
 {
     if (panelTarget != null)
     {
         Destroy(panelTarget);
     }
     panelTarget = Instantiate(panelTargetPrefab, UIBuilder.GetCanvasTransform());
     panelTarget.GetComponent <PanelCharacterTarget>().SetParam(sceneObject);
 }
Пример #4
0
        private void OnTriggerEnter2D(Collider2D collision)
        {
            BaseSceneObject BO = collision.GetComponent <BaseSceneObject>();

            if (BO != null)
            {
                BO.LeavingScene();
            }
        }
Пример #5
0
 // Private
 private static void GetSceneObject(XmlNode sceneObjectNode,
                                    BaseSceneObject baseSceneObject)
 {
     // Tree Object
     if (baseSceneObject is TreeObject)
     {
         CreateTreeObject(sceneObjectNode, baseSceneObject as TreeObject);
     }
     // Barrel Object
     if (baseSceneObject is BarrelObject)
     {
         CreateBarrelObject(sceneObjectNode, baseSceneObject as BarrelObject);
     }
 }
Пример #6
0
    // Public
    static public void GetObjectByName(BaseSceneObject baseSceneObject)
    {
        if (XMLRoot == null)
        {
            XMLDoc.Load("Assets/XML/SceneObjects.xml");
            XMLRoot = XMLDoc.DocumentElement;
        }
        // Get All SceneObjects
        XmlNodeList rootNodes = XMLRoot.GetElementsByTagName("SceneObject");

        foreach (XmlNode sceneObjectNode in rootNodes)
        {
            XmlNodeList sceneObjectNodes = sceneObjectNode.ChildNodes;
            foreach (XmlNode node in sceneObjectNodes)
            {
                // Get SceneObject By Name
                if (node.Name.Equals("Name") &&
                    node.InnerText.Equals(baseSceneObject.sceneObjectName))
                {
                    GetSceneObject(sceneObjectNode, baseSceneObject);
                }
            }
        }
    }
Пример #7
0
 // Constructor
 // Public
 public void SetParam(BaseSceneObject sceneObject)
 {
     // Set Target Name
     textTergetName.text = sceneObject.sceneObjectName;
 }