Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        foreach (ResourcesUni ar in ad.getResources())
        {
            if (ConditionChecker.check(ar.getConditions()))
            {
                Texture2DHolder th  = new Texture2DHolder(ar.getAssetPath(Atrezzo.RESOURCE_TYPE_IMAGE));
                Texture2D       tmp = th.Texture;
                this.GetComponent <Renderer> ().material.mainTexture = tmp;
                this.transform.localScale = new Vector3(tmp.width / 10, tmp.height / 10, 1) * context.getScale();

                Vector2 tmppos = new Vector2(context.getX(), context.getY()) / 10 + (new Vector2(0, -transform.localScale.y)) / 2;
                transform.localPosition = new Vector3(tmppos.x, 60 - tmppos.y, -context.getLayer());
                break;
            }
        }
    }
    /**
     * Constructor.
     *
     * @param atrezzo
     *            Contained atrezzo item
     */
    public AtrezzoDataControl(Atrezzo atrezzo)
    {
        this.atrezzo       = atrezzo;
        this.resourcesList = atrezzo.getResources();

        selectedResources = 0;

        // Add a new resource if the list is empty
        if (resourcesList.Count == 0)
        {
            resourcesList.Add(new ResourcesUni());
        }

        // Create the subcontrollers
        resourcesDataControlList = new List <ResourcesDataControl>();
        foreach (ResourcesUni resources in resourcesList)
        {
            resourcesDataControlList.Add(new ResourcesDataControl(resources, Controller.ATREZZO));
        }
    }
Exemplo n.º 3
0
    public static XmlNode buildDOM(Atrezzo atrezzo)
    {
        XmlElement atrezzoElement = null;

        // Create the necessary elements to create the DOM
        XmlDocument doc = Writer.GetDoc();

        // Create the root node
        atrezzoElement = doc.CreateElement("atrezzoobject");
        atrezzoElement.SetAttribute("id", atrezzo.getId());

        // Append the documentation (if avalaible)
        if (atrezzo.getDocumentation() != null)
        {
            XmlNode atrezzoDocumentationNode = doc.CreateElement("documentation");
            atrezzoDocumentationNode.AppendChild(doc.CreateTextNode(atrezzo.getDocumentation()));
            atrezzoElement.AppendChild(atrezzoDocumentationNode);
        }

        // Append the resources
        foreach (ResourcesUni resources in atrezzo.getResources())
        {
            XmlNode resourcesNode = ResourcesDOMWriter.buildDOM(resources, ResourcesDOMWriter.RESOURCES_ITEM);
            doc.ImportNode(resourcesNode, true);
            atrezzoElement.AppendChild(resourcesNode);
        }

        // atrezzo only have name
        // Create the description
        XmlNode descriptionNode = doc.CreateElement("description");

        // Create and append the name, brief description and detailed description and its soundPaths
        XmlElement nameNode = doc.CreateElement("name");

        if (atrezzo.getDescription(0).getNameSoundPath() != null &&
            !atrezzo.getDescription(0).getNameSoundPath().Equals(""))
        {
            nameNode.SetAttribute("soundPath", atrezzo.getDescription(0).getNameSoundPath());
        }
        nameNode.AppendChild(doc.CreateTextNode(atrezzo.getDescription(0).getName()));
        descriptionNode.AppendChild(nameNode);

        XmlElement briefNode = doc.CreateElement("brief");

        /* if (description.getDescriptionSoundPath( )!=null && !description.getDescriptionSoundPath( ).Equals( "" )){
         *       briefNode.SetAttribute( "soundPath", description.getDescriptionSoundPath( ) );
         *   }
         *   briefNode.AppendChild( doc.CreateTextNode( description.getDescription( ) ) );*/
        briefNode.AppendChild(doc.CreateTextNode(""));
        descriptionNode.AppendChild(briefNode);

        XmlElement detailedNode = doc.CreateElement("detailed");

        /* if (description.getDetailedDescriptionSoundPath( )!=null && !description.getDetailedDescriptionSoundPath( ).Equals( "" )){
         *       detailedNode.SetAttribute( "soundPath", description.getDetailedDescriptionSoundPath( ) );
         *   }
         *   detailedNode.AppendChild( doc.CreateTextNode( description.getDetailedDescription( ) ) );*/
        detailedNode.AppendChild(doc.CreateTextNode(""));
        descriptionNode.AppendChild(detailedNode);

        // Append the description
        atrezzoElement.AppendChild(descriptionNode);


        return(atrezzoElement);
    }