Example #1
0
        public void setObjectFocusedByCamera(CoronaObject obj)
        {
            //Creer deux variables si elles n'existent pas deja
            bool isCreated = false;

            for (int i = 0; i < this.sceneParent.vars.Count; i++)
            {
                CoronaVariable var = this.sceneParent.vars[i];
                if (var.Name.Equals("LastPosX_Focus") || var.Name.Equals("LastPosY_Focus"))
                {
                    isCreated = true;
                    break;
                }
            }

            if (isCreated == false)
            {
                CoronaVariable var_LastPosX = new CoronaVariable("Text", true, "LastPosX_Focus", "nil");
                CoronaVariable var_LastPosY = new CoronaVariable("Text", true, "LastPosY_Focus", "nil");

                this.sceneParent.vars.Add(var_LastPosX);
                this.sceneParent.vars.Add(var_LastPosY);
            }

            this.objectFocusedByCamera = obj;
        }
Example #2
0
        private String createVars(Scene scene, String contentToWrite)
        {
            for (int j = 0; j < scene.vars.Count; j++)
            {
                CoronaVariable cVars = scene.vars[j];

                //Construction of variable lua code
                String buf = "";
                if (cVars.isLocal)
                {
                    buf += "local ";
                }
                buf += cVars.Name;
                if (!cVars.InitValue.Equals(""))
                {
                    buf += " = " + cVars.InitValue;
                }

                contentToWrite += buf + "\n";
            }

            return(contentToWrite);
        }