Exemplo n.º 1
0
 public void activeCamera(GameCamera camera, bool active)
 {
     if (camera == null)
     {
         return;
     }
     if (mUGUICamera != null)
     {
         OT.ACTIVE(camera, active);
         // 如果有非UI摄像机的音频监听组件启用,则禁用UI摄像机的音频监听组件
         bool otherCameraListenerEnabled = false;
         int  count = mCameraList.Count;
         for (int i = 0; i < count; ++i)
         {
             GameCamera item = mCameraList[i];
             if (item != mUGUICamera)
             {
                 if (item.isActive() && item.isUnityComponentEnabled <AudioListener>())
                 {
                     otherCameraListenerEnabled = true;
                     break;
                 }
             }
         }
         // 设置UI摄像机的音频监听组件
         if (mUGUICamera != null && mUGUICamera.isActive())
         {
             mUGUICamera.enableUnityComponent <AudioListener>(!otherCameraListenerEnabled);
         }
     }
 }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync(int?id, int?Did)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            OTs = await _context.OT.FirstOrDefaultAsync(o => o.OTID == Did);

            OTs.TypStatus = "Manage Car";
            _context.Attach(OTs).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OTExists(OTs.OTID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }



            return(RedirectToPage("./../listOTs/ConfirmShuttle", new { id = id, Did = Did }));
        }
Exemplo n.º 3
0
 public void activeCamera(GameCamera camera, bool active)
 {
     if (camera == null)
     {
         return;
     }
     if (mNGUICamera != null || mUGUICamera != null)
     {
         OT.ACTIVE(camera, active);
         // 如果有非UI摄像机的音频监听组件启用,则禁用UI摄像机的音频监听组件
         bool otherCameraListenerEnabled = false;
         foreach (var item in mCameraList)
         {
             if (item != mUGUICamera && item != mNGUICamera)
             {
                 if (item.isActive() && item.isUnityComponentEnabled <AudioListener>())
                 {
                     otherCameraListenerEnabled = true;
                     break;
                 }
             }
         }
         // 设置UI摄像机的音频监听组件
         if (mNGUICamera != null && mNGUICamera.isActive())
         {
             mNGUICamera.enableUnityComponent <AudioListener>(!otherCameraListenerEnabled);
         }
         if (mUGUICamera != null && mUGUICamera.isActive())
         {
             mUGUICamera.enableUnityComponent <AudioListener>(!otherCameraListenerEnabled);
         }
     }
 }
    void LoadSpriteScene()
    {
        List <string> allyStrings  = gameInterfaceAccess.GetAllies();
        List <string> enemyStrings = gameInterfaceAccess.GetEnemies();

        int verticalPos = -170;

        foreach (string enemy in enemyStrings)
        {
            GameObject enemyObj = OT.CreateObject(enemy);
            OTSprite   sprite   = enemyObj.GetComponent("OTSprite") as OTSprite;

            sprite.position = new Vector2(75, verticalPos);
            sprite.depth    = -10;

            verticalPos -= 60;

            InitEnemy(enemyObj, enemy);
        }

        verticalPos = -200;

        foreach (string ally in allyStrings)
        {
            GameObject allyObj = OT.CreateObject(ally);
            OTSprite   sprite  = allyObj.GetComponent("OTSprite") as OTSprite;

            sprite.position = new Vector2(-220, verticalPos);
            sprite.depth    = -10;

            verticalPos -= 60;

            InitAlly(allyObj, ally);
        }
    }
Exemplo n.º 5
0
    // Update is called once per frame
    protected override void Update()
    {
        if (!OT.isValid)
        {
            return;
        }

        if (spriteInvalid)
        {
            SpriteValid();
        }

        if (image == null && spriteContainer == null && _containerName != "")
        {
            OTContainer c = OT.ContainerByName(_containerName);
            if (c != null && c.isReady)
            {
                spriteContainer = c;
            }
        }

        // check if no material has been assigned yet
        if (!Application.isPlaying)
        {
            Material mat = material;
            if (mat == null)
            {
                mat             = new Material(OT.materialTransparent);
                material        = mat;
                mat.mainTexture = texture;
            }
        }
        base.Update();
    }
Exemplo n.º 6
0
        public int BorrarProductoOT(int ID_PRODUCTO_OT)
        {
            PRODUCTOS_OT proot = new PRODUCTOS_OT();

            proot = MostrarProductoOTByID(ID_PRODUCTO_OT);
            int        ID_OT        = int.Parse(proot.ID_OT.ToString());
            string     PRODUCTO_COD = proot.PRODUCTO_COD;
            int        CANTIDAD     = int.Parse(proot.CANTIDAD.ToString());
            int        VALOR_TOTAL  = int.Parse(proot.VALOR_TOTAL.ToString());
            DetalleNeg detalle      = new DetalleNeg();
            DETALLE    newDetalle   = new DETALLE();

            newDetalle = detalle.MostrarDetalleByIDProducto(PRODUCTO_COD);
            int    CANTIDAD_ACTUAL      = int.Parse(newDetalle.CANTIDAD_ACTUAL.ToString());
            string PRODUCTO_COD_DETALLE = newDetalle.PRODUCTO_COD_DETALLE;
            int    CANTIDAD_MINIMA      = int.Parse(newDetalle.CANTIDAD_MINIMA.ToString());
            int    VALOR          = int.Parse(newDetalle.VALOR.ToString());
            int    CANTIDAD_NUEVA = CANTIDAD_ACTUAL + CANTIDAD;
            OTNeg  otneg          = new OTNeg();
            OT     newOT          = new OT();

            newOT = otneg.MostrarOTByID(ID_OT);
            int      NETO_OT     = int.Parse(newOT.NETO_OT.ToString());
            int      NETO_OT_NEW = NETO_OT - VALOR_TOTAL;
            int      ID_SUCURSAL = int.Parse(newOT.ID_SUCURSAL.ToString());
            int      ID_CLIENTE  = int.Parse(newOT.ID_CLIENTE.ToString());
            DateTime FECHA_OT    = DateTime.Parse(newOT.FECHA_OT.ToString());
            string   ESTADO      = newOT.ESTADO;

            detalle.ModificarDetalleByID(PRODUCTO_COD_DETALLE, PRODUCTO_COD, CANTIDAD_MINIMA, CANTIDAD_NUEVA, VALOR);

            otneg.ModificarOTByID(ID_OT, ID_SUCURSAL, ID_CLIENTE, NETO_OT_NEW, FECHA_OT, ESTADO);

            return(ModeloEntidades.spBorrarProductoOT(ID_PRODUCTO_OT));
        }
Exemplo n.º 7
0
    /// <exclude />
    protected override void Start()
    {
        base.Start();
        mr = OT.GetMatRef(materialReference);
        if (Application.isPlaying)
        {
            if (!assignedMaterial)
            {
                Material mat = LookupMaterial();
                if (mat != null)
                {
                    renderer.material = mat;
                    HandleUV(mat);
                }
                else
                {
                    mat = InitMaterial();
                }

                OT.MatInc(mat);
            }
        }
        else
        {
            Material mat = InitMaterial();
            OT.MatInc(mat);
        }

        if (Application.isPlaying)
        {
            _frameIndex_ = -1;
        }
    }
Exemplo n.º 8
0
    public override void execute()
    {
        GameCamera camera = (mReceiver) as GameCamera;

        camera.linkTarget(mLinkerName, mTarget);
        if (mTarget != null)
        {
            // 停止正在进行的摄像机运动
            OT.MOVE_OBJECT(camera, camera.getPosition());
            OT.ROTATE_OBJECT(camera, camera.getRotation());
            CameraLinker linker = camera.getComponent(mLinkerName) as CameraLinker;
            if (linker != null)
            {
                linker.setLookAtTarget(mLookAtTarget);
                linker.setLookAtOffset(mLookatOffset);
                // 不使用原来的相对位置,则设置新的相对位置
                if (!mUseOriginRelative)
                {
                    linker.setRelativePosition(mRelativePosition, mSwitchType, mUseLastSwitchSpeed, mSwitchSpeed);
                }
                if (mImmediately)
                {
                    linker.applyRelativePosition(linker.getNormalRelativePosition());
                }
            }
            else if (mLinkerName != "")
            {
                logError("linker name is not empty, but can not find linker, name : " + mLinkerName);
            }
        }
    }
Exemplo n.º 9
0
    void CleanContainer()
    {
        frames = GetFrames();
        frameByName.Clear();
        for (int f = 0; f < frames.Length; f++)
        {
            frames[f].index = f;
            if (!frameByName.ContainsKey(frames[f].name))
            {
                frameByName.Add(frames[f].name, frames[f]);
            }
        }

        // remove all cached materials for this container
        OT.ClearMaterials("spc:" + name.ToLower() + ":");
        List <OTSprite> sprites = OT.ContainerSprites(this);

        for (int s = 0; s < sprites.Count; s++)
        {
            sprites[s].GetMat();
        }

        if (Application.isPlaying)
        {
            CheckResolutionData();
        }

        dirtyContainer = false;
    }
Exemplo n.º 10
0
 void OnDestroy()
 {
     if (OT.isValid)
     {
         OT.RemoveAnimation(this);
     }
 }
Exemplo n.º 11
0
 void CheckOS()
 {
     if (SystemInfo.operatingSystem.Contains("Windows"))
     {
         if (SystemInfo.operatingSystem.Contains("64bit"))
         {
             OT.Print("Win 64bit");
         }
         else
         {
             OT.Print("Win 32bit");
         }
     }
     else if (SystemInfo.operatingSystem.Contains("Mac"))
     {
         OT.Print("Mac");
     }
     else if (SystemInfo.operatingSystem.Contains("Android"))
     {
         OT.Print("Android");
     }
     else if (SystemInfo.operatingSystem.Contains("iPhone"))
     {
         OT.Print("iOS");
     }
 }
Exemplo n.º 12
0
    void RegisterAnimation()
    {
        if (OT.AnimationByName(name) == null)
        {
            OT.RegisterAnimation(this);
            gameObject.name = name;
            registered      = true;
        }
        if (_name_ != name)
        {
            OT.RegisterAnimationLookup(this, _name_);
            _name_          = name;
            gameObject.name = name;
        }
        if (name != gameObject.name)
        {
            name = gameObject.name;
            OT.RegisterAnimationLookup(this, _name_);
            _name_ = name;
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(this);
            }
#endif
        }
    }
Exemplo n.º 13
0
        public async Task <ActionResult <OT> > PostOT(OT oT)
        {
            _context.OT.Add(oT);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetOT", new { id = oT.OTID }, oT));
        }
Exemplo n.º 14
0
        public async Task <IActionResult> PutOT(int id, OT oT)
        {
            if (id != oT.OTID)
            {
                return(BadRequest());
            }

            _context.Entry(oT).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OTExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 15
0
        private void LoadData(long actuacionId)
        {
            WebServices appService = new WebServices();
            var         res        = appService.Get("http://ctman.constraula.com/CustomersFramework/Constraula/data/itemdatabase.aspx?dataservice=appotbyid&actuacionId=" + actuacionId.ToString());

            if (res.HttpStatusCode != System.Net.HttpStatusCode.OK)
            {
            }
            else
            {
                this.ot = JsonConvert.DeserializeObject <OT>(res.Content);

                this.BtnGaleria1.Text = "Fotos inicio (" + this.ot.I.ToString() + ")";
                this.BtnGaleria2.Text = "Fotos proceso (" + this.ot.P.ToString() + ")";
                this.BtnGaleria3.Text = "Fotos final (" + this.ot.F.ToString() + ")";

                this.LabelCodigoOT.Text  = ot.C;
                this.LabelRosiman.Text   = ot.R;
                this.LabelDireccion.Text = ot.D;

                if (string.IsNullOrEmpty(this.ot.R))
                {
                    this.RowRosmiman.Height = 0;
                }
            }
        }
Exemplo n.º 16
0
 //------------------------------------------------------------------------------------------------------------------------------
 protected void updateSlider(float value)
 {
     mSliderValue = value;
     saturate(ref mSliderValue);
     if (mThumb != null)
     {
         OT.MOVE(mThumb, sliderValueToThumbPos(mSliderValue));
     }
     if (mForeground != null)
     {
         if (mMode == SLIDER_MODE.SM_FILL)
         {
             mForeground.setFillPercent(mSliderValue);
         }
         else if (mMode == SLIDER_MODE.SM_SIZING)
         {
             if (mDirection == DRAG_DIRECTION.DD_HORIZONTAL)
             {
                 float   newWidth   = mSliderValue * mOriginForegroundSize.x;
                 Vector3 newForePos = mOriginForegroundPosition;
                 newForePos.x = mOriginForegroundPosition.x - mOriginForegroundSize.x * 0.5f + newWidth * 0.5f;
                 OT.MOVE(mForeground, newForePos);
                 mForeground.setWindowSize(new Vector2(newWidth, mOriginForegroundSize.y));
             }
             else if (mDirection == DRAG_DIRECTION.DD_VERTICAL)
             {
                 float   newHeight  = mSliderValue * mOriginForegroundSize.y;
                 Vector3 newForePos = mOriginForegroundPosition;
                 newForePos.y = mOriginForegroundPosition.y - mOriginForegroundSize.y * 0.5f + newHeight * 0.5f;
                 OT.MOVE(mForeground, newForePos);
                 mForeground.setWindowSize(new Vector2(mOriginForegroundSize.x, newHeight));
             }
         }
     }
 }
Exemplo n.º 17
0
 void OnDestroy()
 {
     if (OT.isValid)
     {
         OT.RemoveContainer(this);
     }
 }
Exemplo n.º 18
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }


            DetailOT = await _context.DetailOT

                       .Include(d => d.Employee)
                       .Include(d => d.FoodSet)
                       .Include(d => d.OT)
                       .Include(d => d.Part).ToListAsync();



            OT = await _context.OT.ToListAsync();

            OT = OT.Where(s => s.TypStatus.Equals("Open")).ToList();

            Employee = await _context.Employee
                       .Include(e => e.Company)
                       .Include(e => e.Department)
                       .Include(e => e.EmployeeType)
                       .Include(e => e.Location)
                       .Include(e => e.Position).FirstOrDefaultAsync(m => m.EmployeeID == id);

            if (Employee == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 19
0
        protected void btnRegistro_Click(object sender, EventArgs e)
        {
            OT ot = new OT();
            Bu_OrdenTrabajo bu = new Bu_OrdenTrabajo();

            if (ddlEmpresa.SelectedValue == "0")
            {
                Response.Write("<script language=javascript>alert('DEBES SELECCIONAR UNA EMPRESA');</script>");
            }
            else
            {
                try
                {
                    ot.fecha_trabajo       = Convert.ToDateTime(txtFechaTrabajo.Text.Trim());
                    ot.hora_inicio         = txtHoraInicio.Text;
                    ot.hora_fin            = txtHoraTermino.Text;
                    ot.cantidad_hora       = Convert.ToInt32(txtHH.Text.Trim());
                    ot.requerimiento       = txtRequerimiento.Value.Trim().ToUpper();
                    ot.solucion            = txtSolucion.Value.Trim().ToUpper();
                    ot.contacto_empresa_id = Convert.ToInt32(ddlContacto.SelectedValue);
                    ot.id_user             = 16712750;
                    bu.RegistrarOT(ot);
                    recarga();
                }
                catch (Exception)
                {
                    Response.Write("<script language=javascript>alert('ERROR : " + e.ToString() + "');</script>");
                }
            }
        }
Exemplo n.º 20
0
    // This method will explode an asteroid

    public void Explode(OTObject o, CBullet3 bullet)
    {
        // Determine how many debree has to be be created
        int blocks = 2 + (int)Mathf.Floor(Random.value * 2);

        // Create debree
        for (int b = 0; b < blocks; b++)
        {
            // Shrink asteroid's rect to act as the random position container
            // for the debree
            Rect r = new Rect(
                o.rect.x + o.rect.width / 4,
                o.rect.y + o.rect.height / 4,
                o.rect.width / 2,
                o.rect.height / 2);
            // Create a debree that is relatively smaller than the asteroid that was detroyed
            OTAnimatingSprite a = RandomBlock(r, 0.6f, 0.75f, o);

            // Add this debree to the bullet telling the bullet to ignore this debree
            // in this update cycle - otherwise the bullet explosions could enter some
            // recursive 'dead' loop creating LOTS of debree
            bullet.AddDebree(a);
            // Recusively explode 2 asteroids if they are big enough, to get a nice
            // exploding debree effect.
            if (b < 2 && a.size.x > 30)
            {
                Explode(a, bullet);
            }
        }
        // Notify that this asteroid has to be destroyed
        OT.DestroyObject(o);
    }
Exemplo n.º 21
0
    protected override void Update()
    {
        if (animation == null && _animationName != null)
        {
            animation = OT.AnimationByName(_animationName);
        }

        if (spriteContainer != null && !spriteContainer.isReady)
        {
            return;
        }

        if (speed < 0)
        {
            speed = 0;
        }
        if (Application.isPlaying && animation != null && animation.isReady && _playing)
        {
            if (waiting)
            {
                HandleWaiting();
            }

            if (!waiting)
            {
                UpdateFrame();
            }
        }
        else
        {
            EditorPreview();
        }

        base.Update();
    }
Exemplo n.º 22
0
    // Update is called once per frame
    void Update()
    {
        // Check if we have to ignore colliding with created debree
        if (ignoreCollisions > 0)
        {
            // increase ignore time
            ignoreCollisions -= Time.deltaTime;
            if (ignoreCollisions < 0)
            {
                ignoreCollisions = 0;
            }
        }
        else
        {
            // we no longer have to ignore the created debree so
            // lets clear the debree list.
            debree.Clear();
        }

        // Update bullet position
        sprite.position += (Vector2)sprite.yVector * speed * Time.deltaTime;
        // Destroy bullet as it moves out of view
        if (sprite.outOfView)
        {
            OT.DestroyObject(sprite);
        }
    }
Exemplo n.º 23
0
 // Update is called once per frame
 void Update()
 {
     if (OT.Clicked(GameObject.Find("asteroid-1").GetComponent <OTAnimatingSprite>()))
     {
         GameObject.Find("asteroid-1").GetComponent <OTAnimatingSprite>().Reverse();
     }
 }
Exemplo n.º 24
0
    void Start()
    {
        TextMesh tPingPong = GameObject.Find("ping-pong").GetComponent <TextMesh>();
        TextMesh tPlayed   = GameObject.Find("count").GetComponent <TextMesh>();

        // set green star looping ping pong tween
        new OTTween(OT.Sprite("star-pingpong"), 2, OTEasing.Linear).
        TweenAdd("position", new Vector2(500, 0), OTEasing.StrongInOut, OTEasing.StrongInOut).PingPong().Loop().
        OnPing(delegate(OTTween tween){
            tPingPong.text = "PING";
        }).
        OnPong(delegate(OTTween tween){
            tPingPong.text = "PONG";
        });

        // set orange star moving 5 times using an add tween
        new OTTween(OT.Sprite("star-moving"), .5f, OTEasing.Linear).
        TweenAdd("position", new Vector2(100f, 0), OTEasing.StrongIn).PlayCount(5).
        OnPlayed(delegate(OTTween tween){
            tPlayed.text = "" + tween.played;
        }).
        OnFinish(delegate(OTTween tween){
            // after it finishes, wait 2 seconds and restart the tween
            OT.Execute(2, delegate() {
                tPlayed.text = "";
                tween.Restart();
            });
        });
    }
Exemplo n.º 25
0
        protected void btnRegistro_Click(object sender, EventArgs e)
        {
            OT ot = new OT();
            Bu_OrdenTrabajo bu = new Bu_OrdenTrabajo();

            if (ddlCliente.SelectedValue == "0")
            {
                Response.Write("<script language=javascript>alert('DEBES SELECCIONAR UNA EMPRESA');</script>");
            }
            else
            {
                ot.fecha_inicio = Convert.ToDateTime(txtFechaTrabajo.Text.Trim());
            }
            //else if (txtRequerimiento.t)
            //{
            //    //u.usuario_rut = v.Aux;
            //    //u.usuario_dv = v.dv;
            //    //u.usuario_us = txtUs.Text.Trim();
            //    //u.usuario_pw = txtPw.Text.Trim();
            //    //u.usuario_nombre = txtNombre.Text.Trim();
            //    //u.usuario_paterno = txtPaterno.Text.Trim();
            //    //u.usuario_materno = txtMaterno.Text.Trim();
            //    //u.usuario_nacimiento = Convert.ToDateTime(txtNacimiento.Text.Trim());
            //    //u.id_user = 16712750;
            //    //u.tipo_usuario_id = Convert.ToInt32(ddlTipoUsuario.SelectedValue);
            //    //bu.IngresaUsuario(u);
            //}
            //else
            //{
            //    Response.Write("<script language=javascript>alert('RUT INVALIDO VERIFIQUE');</script>");
            //}
        }
    static public void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        List <Texture2D> textures = new List <Texture2D>();

        foreach (string str in importedAssets)
        {
            Texture2D tx = AssetDatabase.LoadAssetAtPath(str, typeof(Texture2D)) as Texture2D;
            if (tx != null)
            {
                textures.Add(tx);
            }
        }

        if (textures.Count > 0)
        {
            for (int i = 0; i < textures.Count; i++)
            {
                OTContainer c = OT.ContainerByTexture(textures[i]);
                if (c != null)
                {
                    if (c is OTSpriteAtlasImport)
                    {
                        (c as OTSpriteAtlasImport).reloadData = true;
                        (c as OTSpriteAtlasImport).Reset(true);
                    }
                    else
                    {
                        c.Reset(true);
                    }
                    OT.Reset();
                }
            }
        }
    }
Exemplo n.º 27
0
 // Update is called once per frame
 void Update()
 {
     t += Time.deltaTime;
     if (t > 20)
     {
         OT.DestroyObject(sprite.transform.parent.gameObject);
     }
 }
    void AnimateOnce()
    {
        Debug.Log("animating");
        GameObject animateObj = OT.CreateObject("fireball");

        animateMe = animateObj.GetComponent("OTAnimatingSprite") as OTAnimatingSprite;
        animateMe.PlayOnce("fire");
    }
Exemplo n.º 29
0
 // OnExit delegate is called when star no longer overlaps another 'collidable' object
 /// <exclude />
 public void OnExit(OTObject owner)
 {
     // check if we have left another star and adjust color if we did
     if (owner.collisionObject.name.IndexOf("star") == 0)
     {
         sprite.material = OT.LookupMaterial("Star-start");
     }
 }
Exemplo n.º 30
0
    public void copyObjectTransform(GameObject obj)
    {
        Transform objTrans = obj.transform;

        OT.MOVE_OBJECT(this, objTrans.localPosition);
        OT.ROTATE_OBJECT(this, objTrans.localEulerAngles);
        OT.SCALE_OBJECT(this, objTrans.localScale);
    }
Exemplo n.º 31
0
    // Use this for initialization
    void Awake()
    {
        instance = this;
        // find view class as child of the OT main class
        for (int c = 0; c < transform.childCount; c++)
        {
            _view = transform.GetChild(c).gameObject.GetComponent<OTView>();
            if (_view != null)
                break;
        }
        if (view != null) view.InitView();

        if (Application.isPlaying)
        {
            OTObjectType.lookup.Clear();
            for (int o = 0; o < objectPrototypes.Length; o++)
                OTObjectType.lookup.Add(objectPrototypes[o].name.ToLower(), objectPrototypes[o].prototype);

            // check if we have an OT/Prototypes folder
            for (int c = 0; c < transform.childCount; c++)
            {
                string n = transform.GetChild(c).gameObject.name.ToLower();
                if (n == "prototype" || n == "prototypes")
                {
                    Transform t = transform.GetChild(c);
                    // object prototypes found so add them to the lookup table
                    for (int p = 0; p < t.childCount; p++)
                        OTObjectType.lookup.Add(t.GetChild(p).gameObject.name.ToLower(), t.GetChild(p).gameObject);
                    break;
                }
            }
        }
    }
Exemplo n.º 32
0
    // Use this for initialization
    void Awake()
    {
        instance = this;
		_sound = instance.GetComponent<OTSounds>();
		if (_sound==null)
			_sound = instance.gameObject.AddComponent<OTSounds>();
		
        // find view class as child of the OT main class
        for (int c = 0; c < transform.childCount; c++)
        {
            _view = transform.GetChild(c).gameObject.GetComponent<OTView>();
            if (_view != null)
                break;
        }
        if (view != null) view.InitView();
		
		_world_ = _world;

        if (Application.isPlaying)
        {
            OTObjectType.lookup.Clear();
            for (int o = 0; o < objectPrototypes.Length; o++)
			{
				if (!OTObjectType.lookup.ContainsKey(objectPrototypes[o].name.ToLower()))
                	OTObjectType.lookup.Add(objectPrototypes[o].name.ToLower(), objectPrototypes[o].prototype);
				else
					Debug.LogWarning("duplicate object prototype OT.objectPrototype "+objectPrototypes[o].name);
			}

            // check if we have an OT/Prototypes folder
            for (int c = 0; c < transform.childCount; c++)
            {
                string n = transform.GetChild(c).gameObject.name.ToLower();
                if (n == "prototype" || n == "prototypes")
                {
                    Transform t = transform.GetChild(c);
                    // object prototypes found so add them to the lookup table
                    for (int p = 0; p < t.childCount; p++)
					{
						string na = t.GetChild(p).gameObject.name.ToLower();
						if (!OTObjectType.lookup.ContainsKey(na))
                        	OTObjectType.lookup.Add(na, t.GetChild(p).gameObject);
						else
							Debug.LogWarning("duplicate object prototype : OT.prototypes."+t.GetChild(p).gameObject.name);
						
						if (deactivatePrototypes)
							t.GetChild(p).gameObject.SetActiveRecursively(false);							
					}
                    break;
                }
            }
			
        }
    }
Exemplo n.º 33
0
    // Update is called once per frame
    void Update()
    {
        if (instance == null) instance = this;

        #if UNITY_EDITOR
        recordModeCheckTime+=Time.deltaTime;
        if (recordModeCheckTime > checkRecordModeFrequency)
        {
            _recordMode = RecordMode(false,false);
            recordModeCheckTime = 0;
        }
        #endif

        if (Application.isEditor || dirtyChecks)
        {
            if (!Vector3.Equals(transform.position, Vector3.zero))
                transform.position = Vector3.zero;

            if (dirtyChecks && runTimeCreationMode && dirtyChecksUpdateCycles++ > 10)
            {
                dirtyChecks = false;
                runTimeCreationMode = false;
            }

        }

        // check for clicks
        if (inputObjects.Count > 0)
        {
            if (Input.touchCount > 0 ||
                Input.GetMouseButton(0) ||
                Input.GetMouseButton(1) ||
                Input.GetMouseButton(2) ||
                Input.GetMouseButtonDown(0) ||
                Input.GetMouseButtonDown(1) ||
                Input.GetMouseButtonDown(2) ||
                Input.GetMouseButtonUp(0) ||
                Input.GetMouseButtonUp(1) ||
                Input.GetMouseButtonUp(2))
            {
                if (Input.touchCount > 0)
                    HandleInput(Input.touches[0].position);
                else
                    HandleInput(Input.mousePosition);
            }
        }

        // calculate fps every 100ms
        fpsTime += Time.deltaTime;
        if (fpsTime >= 0.1f)
        {
            _fps = 1 / Time.deltaTime;
            fpsTime = 0;
        }

        if (controllers.Count > 0)
        {
            for (int c = 0; c < controllers.Count; c++)
            {
                OTController co = controllers[c];
                if (co.enabled)
                    co.Update(Time.deltaTime);
            }
        }
    }
Exemplo n.º 34
0
    // Update is called once per frame
    void Update()
    {
        if (instance == null) instance = this;
		
		if (_reset || _world_!=_world)
		{
			if (_world_!=_world)
			{
				_world_ = _world;
				view.InitView();
			}
						
			_Reset();
			_reset = false;
		}
						
#if UNITY_EDITOR	
		recordModeCheckTime+=Time.deltaTime;
		if (recordModeCheckTime > checkRecordModeFrequency)
		{
			_recordMode = RecordMode(false,false);
			recordModeCheckTime = 0;
		}
#endif
		
        if (Application.isEditor || dirtyChecks)
        {
            if (!Vector3.Equals(transform.position, Vector3.zero))
                transform.position = Vector3.zero;
			
			if (dirtyChecks && runTimeCreationMode && dirtyChecksUpdateCycles++ > 10)
			{
				dirtyChecks = false;
				runTimeCreationMode = false;
			}
			
        }

        // check for clicks
        if (inputObjects.Count > 0)
        {
            if (Input.touchCount > 0 ||
                Input.GetMouseButton(0) ||
                Input.GetMouseButton(1) ||
                Input.GetMouseButton(2) ||
                Input.GetMouseButtonDown(0) ||
                Input.GetMouseButtonDown(1) ||
                Input.GetMouseButtonDown(2) ||
                Input.GetMouseButtonUp(0) ||
                Input.GetMouseButtonUp(1) ||
                Input.GetMouseButtonUp(2))
            {												
				if ((!(mobile && multiDrag)) && OTDragObject.isDragging)
				{
					if (mobile)
						for (int t=0; t<Input.touches.Length; t++)
							if (Input.touches[t].fingerId == OTDragObject.dragObjects[0].finger)
							{
								_touch = Input.touches[t];
								break;
							}
					
					DragControl(OTDragObject.dragObjects[0].dragObject);
				}
				else
				{							
	                if (Input.touchCount > 0)
					{
						List<int> fingers = new List<int>();
						for (int t=0; t<Input.touches.Length; t++)
						{
							_touch = Input.touches[t];
							if (mobile && multiDrag && OTDragObject.dragObjects.Count>0)
							{
								OTDragObject o = OTDragObject.ByFinger(touch.fingerId);
								if (o!=null && o.dragObject!=null && o.dragging)
									DragControl(o.dragObject);
							}
							
							if (_touch.phase !=  TouchPhase.Ended && _touch.phase !=  TouchPhase.Canceled)
								fingers.Add(touch.fingerId);
							
	                    	HandleInput(touch.position);
							
						}
						
						if (mobile && multiDrag && OTDragObject.dragObjects.Count>0)
						{
							if (Input.touches.Length==0)
								OTDragObject.Clear();
							else
							{								
								int i=0;
								while (i<OTDragObject.dragObjects.Count)
								{
									if (OTDragObject.dragObjects[i].dragging && !fingers.Contains(OTDragObject.dragObjects[i].finger))
										EndDragObject(i);
									else
										i++;
								}
							}
						}							
					}
	                else
	                    HandleInput(Input.mousePosition);                     
				}
            }
			else
			{
				if (mobile && Input.touchCount == 0)
				{					
					while (OTDragObject.dragObjects.Count>0)
						EndDragObject(0);
					OTDragObject.Clear();
				}
			}
        }

		if (maybeDrag && !Input.GetMouseButton(maybeButton))
			maybeDrag = false;
		
		
        // calculate fps every 100ms
        fpsTime += Time.deltaTime;
        if (fpsTime >= 0.25f)
        {
            _fps = (_fps + (int)1 / Time.deltaTime)/2;
            fpsTime = 0;
        }
		
		
		if (controllers.Count > 0)
        {
            for (int c = 0; c < controllers.Count; c++)
            {
                OTController co = controllers[c];
                if (co.enabled)
                    co.Update(Time.deltaTime);
            }
        }
		
		if (debug)
			OTDebug.Update();
		
    }