コード例 #1
0
 /// <summary>
 /// Here we have a superclass intercept for catching global TinkerGraphic mouse down events.
 /// If graphic is paired to text ,this fuction is called.
 /// </summary>
 /// <param name="tinkerGraphic">Tinker graphic.</param>
 public virtual void OnMouseDown(GTinkerGraphic tinkerGraphic)
 {
     if (tinkerGraphic.pairedText1 != null)
     {
         stanzaManager.OnPairedMouseDown(tinkerGraphic.pairedText1);
     }
 }
コード例 #2
0
    public override void OnMouseDown(GameObject go)
    {
        if (go.name == "CatHam")
        {
            ham.SetActive(true);
        }
        else if (go.name == "Text_ham")
        {
            ham.SetActive(true);
            GTinkerGraphic catHam = GameObject.Find("CatHam").GetComponent <GTinkerGraphic> ();
            if (catHam != null)
            {
                //catHam.reset();
                catHam.MyOnMouseDown();
            }
        }
        //		else if (go.name == "Ham")
        //		{
        //			ham = go;
        //			GTinkerGraphic catHam = GameObject.Find("CatHam").GetComponent<GTinkerGraphic>();
        //			if (catHam != null)
        //			{
        //				catHam.MyOnMouseDown();
        //			}
        //		}

        base.OnMouseDown(go);
    }
コード例 #3
0
 /// <summary>
 /// Here we have a superclass intercept for catching global TinkerGraphic mouse currently down events.
 /// Move the graphic if draggable.
 /// </summary>
 /// <param name="tinkerGraphic">Tinker graphic.</param>
 public virtual void OnMouseCurrentlyDown(GTinkerGraphic tinkerGraphic)
 {
     if (tinkerGraphic.GetDraggable())
     {
         tinkerGraphic.MoveObject();
     }
 }
コード例 #4
0
    /// <summary>
    /// Here we have a superclass intercept for catching global GameObject mouse up events.
    /// If object not draggable and tinker text is not null , call stanza manager onMouseUp(tinkertext).
    /// If tinkergraphic , call tinkrgraphic.MyOnMouseUp.
    /// This function can be overriden by specific scene manager.
    /// </summary>
    /// <param name="go">Game Object selected.</param>
    public virtual void OnMouseUp(GameObject go)
    {
        // Got a TinkerText object? (Also, make sure dragActive is false)
        if (!dragActive && go.GetComponent <GTinkerText>() != null)
        {
            GTinkerText tinkerText = go.GetComponent <GTinkerText>();

            if (tinkerText != null)
            {
                if (stanzaManager != null)
                {
                    stanzaManager.OnMouseUp(tinkerText);
                }
            }
        }
        // TinkerGraphic object
        else if (go.GetComponent <GTinkerGraphic>() != null)
        {
            GTinkerGraphic tinkerGraphic = go.GetComponent <GTinkerGraphic>();

            if (tinkerGraphic != null)
            {
                tinkerGraphic.MyOnMouseUp();
            }
        }
    }
コード例 #5
0
    public override void OnMouseDown(GameObject go)
    {
        if (go.name == "Cat")
        {
            GTinkerGraphic tinkerGraphic = GameObject.Find("Ran").GetComponent <GTinkerGraphic> ();
            if (tinkerGraphic != null)
            {
                tinkerGraphic.MyOnMouseDown();
            }
        }
        else if (go.name == "Ran")
        {
            GTinkerGraphic tinkerGraphic = GameObject.Find("Cat").GetComponent <GTinkerGraphic> ();
            if (tinkerGraphic != null)
            {
                tinkerGraphic.MyOnMouseDown();
            }
        }

        /*
         *       else if (go.name == "Text_ran") {
         *              Debug.Log ("text ran");
         *              GTinkerGraphic ranGraphic = GameObject.Find ("Ran").GetComponent<GTinkerGraphic> ();
         *              GTinkerGraphic catGraphic = GameObject.Find ("Cat").GetComponent<GTinkerGraphic> ();
         *              if (ranGraphic != null && catGraphic!=null) {
         *                      catGraphic.MyOnMouseDown ();
         *                      ranGraphic.MyOnMouseDown ();
         *
         *              }
         *
         *      }*/
        base.OnMouseDown(go);
    }
コード例 #6
0
    /// <summary>
    /// Here we have a superclass intercept for catching global GameObject mouse currently down events.
    /// If input is allowed(during stanza play / after stanza play) check if Tinkertext or Tinkergraphic
    /// If tinkertext , call stanzamanager onmousecurrentlydown(tinkrtext).
    /// If tinkergraphic , call tinkrgraphic onmousecurrentlydown.
    /// This function can be overriden by specific scene manager.
    /// </summary>
    /// <param name="go">Game object clicked.</param>
    public virtual void OnMouseCurrentlyDown(GameObject go)
    {
        // Lock out other input during auto play?
        if (IsInputAllowed())
        {
            // TinkerGraphic object
            if (go.GetComponent <GTinkerGraphic>() != null)
            {
                GTinkerGraphic tinkerGraphic = go.GetComponent <GTinkerGraphic>();

                if (tinkerGraphic != null)
                {
                    tinkerGraphic.OnMouseCurrentlyDown();
                }
            }
            // TinkerText object
            else if (!dragActive && go.GetComponent <GTinkerText>() != null)
            {
                GTinkerText tinkerText = go.GetComponent <GTinkerText>();

                if (tinkerText != null)
                {
                    if (stanzaManager != null)
                    {
                        // Only allow further drag events if we aren't autoplaying
                        if (!stanzaManager.IsAutoPlaying())
                        {
                            stanzaManager.OnMouseCurrentlyDown(tinkerText);
                        }
                    }
                }
            }
        }
    }
コード例 #7
0
    /// <summary>
    /// If input is allowed(during stanza play / after stanza play) check if Tinkertext or Tinkergraphic
    /// If tinkertext , call stanzamanager onmousedown(tinkrtext).
    /// If tinkergraphic , call tinkrgraphic.mymousedown.
    /// This function can be overriden by specific scene manager.
    /// </summary>
    public virtual void OnMouseDown(GameObject go)
    {
        stanzaManager.RequestCancelAutoPlay();          // to stop auto narration when anything is clicked
        // Lock out other input during auto play?
        if (IsInputAllowed())
        {
            // TinkerText object
            if (go.GetComponent <GTinkerText>() != null)
            {
                GTinkerText tinkerText = go.GetComponent <GTinkerText>();

                if (tinkerText != null)
                {
                    if (stanzaManager != null)
                    {
                        // Is an autoplay in progress? If so, see if we should interrupt
                        if (stanzaManager.IsAutoPlaying() && inputInterruptsAutoplay)
                        {
                            stanzaManager.RequestCancelAutoPlay();
                        }
                        stanzaManager.OnMouseDown(tinkerText);
                    }
                }
            }
            // TinkerGraphic object
            else if (go.GetComponent <GTinkerGraphic>() != null)
            {
                GTinkerGraphic tinkerGraphic = go.GetComponent <GTinkerGraphic>();
                if (tinkerGraphic != null)
                {
                    tinkerGraphic.MyOnMouseDown();
                }
            }
        }
    }
コード例 #8
0
    public override void OnMouseDown(GameObject go)
    {
        if (go.name == "Cat")
        {
            GTinkerGraphic tinkerGraphic = GameObject.Find("Ran").GetComponent <GTinkerGraphic> ();
            if (tinkerGraphic != null)
            {
                tinkerGraphic.PlayCompleteAnim();
            }
        }
        else if (go.name == "Ran")
        {
            GTinkerGraphic tinkerGraphic = GameObject.Find("Cat").GetComponent <GTinkerGraphic> ();
            if (tinkerGraphic != null)
            {
                tinkerGraphic.PlayCompleteAnim();
            }
        }
        else if (go.name == "Text_cat")
        {
            GTinkerGraphic tinkerGraphic = GameObject.Find("Ran").GetComponent <GTinkerGraphic> ();
            if (tinkerGraphic != null)
            {
                tinkerGraphic.gameObject.transform.position = new Vector3(tinkerGraphic.dataTinkerGraphic.posX, tinkerGraphic.dataTinkerGraphic.posY, 0);
                LoadAssetFromJSON.LoadAssetImage(tinkerGraphic, tinkerGraphic.dataTinkerGraphic.imageName);
            }
        }


        base.OnMouseDown(go);
    }
コード例 #9
0
 public override void OnMouseDown(GameObject go)
 {
     if (go.name == "Jam" || go.name == "Text_jam.")
     {
         GTinkerGraphic cat = GameObject.Find("Cat").GetComponent <GTinkerGraphic>();
         if (cat != null)
         {
             cat.MyOnMouseDown();
         }
     }
     base.OnMouseDown(go);
 }
コード例 #10
0
    /// <summary>
    /// Loads the animation images.
    /// </summary>
    /// <param name="tinkerGraphic">Tinker graphic.</param>
    /// <param name="startName">Start name.</param>
    /// <param name="length">Number of the animation frames.</param>
    public static void LoadAssetImages(GTinkerGraphic tinkerGraphic, string startName, int startindex, int endindex, int startx, int starty)
    {
        int j = 0;

        tinkerGraphic.transform.position = new Vector3(startx, starty, 0);
        int length = endindex - startindex + 1;

        tinkerGraphic.sprite = new Sprite[length];
        for (int i = startindex; i <= endindex; i++)
        {
            var sprite = ShelfManager.bundleLoaded.LoadAsset <Sprite>(startName + "-" + (i + 1));
            tinkerGraphic.sprite[j] = sprite;
            j++;
        }
    }
コード例 #11
0
    public override void OnMouseDown(GameObject go)
    {
        if (go.name == "Cat" || go.name == "Text_nap?")
        {
            if (sleep == null)
            {
                sleep = GameObject.Find("Sleep").GetComponent <GTinkerGraphic> ();
            }
            sleep.MyOnMouseDown();
        }
        else if (go.name == "Sleep")
        {
            GameObject.Find("Cat").GetComponent <GTinkerGraphic> ().MyOnMouseDown();
        }

        base.OnMouseDown(go);
    }
コード例 #12
0
    public override void OnMouseDown(GameObject go)
    {
        if (go.name == "Fat" || go.name == "Text_Fat")
        {
            if (fat == null)
            {
                fat = GameObject.Find("Fat");
            }
            fat.SetActive(false);
            GameObject     seqAnim = GameObject.Find("FatCatRun");
            GTinkerGraphic fatCat  = seqAnim.GetComponent <GTinkerGraphic>();
            if (fatCat != null)
            {
                fatCat.MyOnMouseDown();
            }
        }

        base.OnMouseDown(go);
    }
コード例 #13
0
    public override void OnMouseDown(GameObject go)
    {
        if (go.name == "CatJam")
        {
            if (ham == null)
            {
                ham = GameObject.Find("Jam");
            }

            ham.SetActive(true);
        }
        else if (go.name == "Text_jam")
        {
            if (ham == null)
            {
                ham = GameObject.Find("Jam");
            }

            ham.SetActive(true);
            GTinkerGraphic catHam = GameObject.Find("CatJam").GetComponent <GTinkerGraphic>();
            if (catHam != null)
            {
                catHam.MyOnMouseDown();
            }
        }
        else if (go.name == "Jam")
        {
            ham = go;
            GTinkerGraphic catHam = GameObject.Find("CatJam").GetComponent <GTinkerGraphic>();
            if (catHam != null)
            {
                catHam.MyOnMouseDown();
            }
        }

        base.OnMouseDown(go);
    }
コード例 #14
0
 /// <summary>
 /// Raises the paired mouse down event for tinkergraphic.
 /// </summary>
 /// <param name="tinkerGraphic">Tinker graphic.</param>
 public void OnPairedMouseDown(GTinkerGraphic tinkerGraphic)
 {
     sceneManager.OnMouseDown(this);
 }
コード例 #15
0
 public override void Start()
 {
     ham    = GameObject.Find("Ham");
     catHam = GameObject.Find("CatHam").GetComponent <GTinkerGraphic>();
     base.Start();
 }
コード例 #16
0
 /// <summary>
 /// Here we have a superclass intercept for catching global TinkerGraphic mouse up events.
 /// </summary>
 /// <param name="tinkerGraphic">Tinker graphic.</param>
 public virtual void OnMouseUp(GTinkerGraphic tinkerGraphic)
 {
     // override me
 }
コード例 #17
0
    /// <summary>
    /// Loads the asset image.
    /// </summary>
    /// <param name="name">Namevof the asset image.</param>
    /// <param name="sr">Sprite Renderer.</param>
    public static void LoadAssetImage(GTinkerGraphic tinkergraphic, string name)
    {
        var sprite = ShelfManager.bundleLoaded.LoadAsset <Sprite>(name);

        tinkergraphic.spr.sprite = sprite;
    }
コード例 #18
0
 public override void Start()
 {
     ranman = GameObject.Find("Ran").GetComponent <GTinkerGraphic>();
     cat    = GameObject.Find("Cat").GetComponent <GTinkerGraphic>();
     base.Start();
 }