Esempio n. 1
0
    public void Duplicate()
    {
        if (rectTransform.localPosition.x + rectTransform.sizeDelta.x * rectTransform.localScale.x < 280)
        {
            GameObject go = Instantiate(this.gameObject, this.transform.parent);

            RectTransform gorc     = go.GetComponent <RectTransform>();
            RawImage      rawImage = go.GetComponent <RawImage>();
            if (rawImage != null)
            {
                rawImage.DOFade(0, 0f);
                rawImage.DOFade(1, 0.5f);
            }
            Vector3 scaledGO = gorc.localScale;
            //gorc.localScale = Vector3.zero;
            gorc.DOMoveX(gorc.position.x + (gorc.sizeDelta.x / 43 * this.gameObject.transform.localScale.x), 0.5f);
            //gorc.DOScale(scaledGO, 0.5f);
            GeneratedObject generatedObject = go.GetComponent <GeneratedObject>();
            ObjectT         objectT         = go.GetComponent <ObjectT>();
            if (generatedObject.type == "Drag")
            {
                ObjectSPawner.Instance.AssignId(generatedObject, objectT);
                generatedObject.pair = null;
            }

            if (generatedObject is ItemSlot)
            {
                gorc.transform.SetAsFirstSibling();
            }
            ObjectModificator.Instance.SelectObject(generatedObject, objectT);
            SoundManager.Instance.PlaySound(0);
        }
        UpdatePair();
    }
Esempio n. 2
0
 public void UnselectObject()
 {
     OT.OnUnselectObject();
     go = null;
     OT = null;
     DeactivatePanels();
 }
Esempio n. 3
0
 public void SetupPanel(RawImage img, RectTransform rect, ObjectT objt, GeneratedObject go)
 {
     this.objT = objt;
     tvar      = img;
     this.rect = rect;
     SetButtonColor(colorBtn, img.color);
     objectName.text = go.objectName;
     this.GO         = go;
 }
Esempio n. 4
0
 public void SetupPanel(RectTransform rect, RawImage ri, ObjectT objT)
 {
     this.objT        = objT;
     selectedRT       = rect;
     sirkaInp.text    = "";
     vyskaInp.text    = "";
     sirkaInp.text    = Mathf.RoundToInt(rect.rect.width).ToString();
     vyskaInp.text    = Mathf.RoundToInt(rect.rect.height).ToString();
     percentInp.text  = ScaleToPercent(selectedRT.localScale.x).ToString();
     rotationInp.text = Mathf.RoundToInt(selectedRT.localEulerAngles.z).ToString();
     rawImage         = ri;
 }
Esempio n. 5
0
    public void SetupPanel(ObjectT ot, ItemSlot text)
    {
        objectT    = ot;
        textObject = text;
        Color c = textObject.img.color;

        if (c.a == 0)
        {
            toggle.isOn = false;
        }
        else
        {
            toggle.isOn = true;
        }
    }
Esempio n. 6
0
 public void AssignId(GeneratedObject generatedObject, ObjectT objectT)
 {
     if (objectT.typ.Equals(GenObjectType.Drag))
     {
         if (objectT.prefabTyp.Equals(PrefabType.Tvar))
         {
             generatedObject.objectName = "Tvar " + objectContextID;
             generatedObject.GetComponent <DragDrop>().contextID = objectContextID;
             objectContextID++;
         }
         if (objectT.prefabTyp.Equals(PrefabType.Basic))
         {
             generatedObject.objectName = "Obraz " + objectContextID;
             generatedObject.GetComponent <DragDrop>().contextID = objectContextID;
             objectContextID++;
         }
     }
 }
Esempio n. 7
0
 public void SetupPanel(GeneratedObject generatedObject, ObjectT objectT)
 {
     nameText.text = generatedObject.objectName;
     if (objectT.velkost.Length > 4)
     {
         velkostTxt.text = objectT.velkost;
     }
     else
     {
         velkostTxt.text = "-obrázok nenahratý-";
     }
     if (objectT.typ.Equals(GenObjectType.Static))
     {
         imgLoader.SetActive(false);
     }
     else
     {
         imgLoader.SetActive(true);
     }
 }
Esempio n. 8
0
    public void GenerateFriend()
    {
        ObjectT  mainOT = ObjectModificator.Instance.OT;
        DragDrop mainGO = ObjectModificator.Instance.go.GetComponent <DragDrop>();

        if (mainGO.pair != null)
        {
            Debug.Log(Vector3.Distance(mainGO.pair.transform.position, mainGO.transform.position));
            if (Vector3.Distance(mainGO.pair.transform.position, mainGO.transform.position) < 0.5f)
            {
                mainGO.pair.GetComponent <ObjectT>().FadeOut();
            }
        }
        GameObject go = Instantiate(mainGO.gameObject, spawnArea.transform);

        go.transform.SetAsFirstSibling();
        Destroy(go.GetComponent <DragDrop>());
        ItemSlot itemslot = go.AddComponent <ItemSlot>();

        go.GetComponent <ObjectT>().SetTyp(GenObjectType.Static, icons[2]);
        itemslot.outline.enabled = false;
        itemslot.contextID       = mainGO.contextID;
        if (mainOT.prefabTyp.Equals(PrefabType.Tvar))
        {
        }
        if (mainOT.prefabTyp.Equals(PrefabType.Basic))
        {
            itemslot.img.texture = basicTexture;
        }
        itemslot.objectName = "Miesto: " + mainGO.objectName;
        itemslot.type       = "Stat";
        itemslot.editor     = true;
        itemslot.img.color  = Color.gray;
        mainGO.pair         = itemslot.gameObject;
        itemslot.imageID    = mainGO.imageID;
        itemslot.pair       = mainGO.gameObject;
        ObjectModificator.Instance.activePanel.UpdateFriendTxt();
        mainOT.UpdatePair();
    }
Esempio n. 9
0
    public void SelectObject(GeneratedObject go, ObjectT OT)
    {
        if (this.OT != null)
        {
            if (!OT.Equals(this.OT))
            {
                this.OT.OnUnselectObject();
            }
            else
            {
                return;
            }
        }
        this.go = go;
        this.OT = OT;
        DeactivatePanels();
        OT.OnSelectObject();
        generalPanel.gameObject.SetActive(true);
        generalPanel.SetupPanel(go.rectTransform, OT.img, OT);
        galeria.SetupGalery(OT, go);

        if (OT.prefabTyp.Equals(PrefabType.Tvar))
        {
            tvarPanel.gameObject.SetActive(true);
            tvarPanel.SetupPanel(OT.img, go.rectTransform, OT, go);
            if (OT.typ.Equals(GenObjectType.Static))
            {
                staticPanel.gameObject.SetActive(true);
                staticPanel.SetupPanel((ItemSlot)go);
            }
            if (OT.typ.Equals(GenObjectType.Drag))
            {
                activePanel.gameObject.SetActive(true);
                activePanel.SetupPanel((GeneratedObject)go);
            }
        }
        if (OT.prefabTyp.Equals(PrefabType.Basic))
        {
            obrPanel.gameObject.SetActive(true);
            obrPanel.SetupPanel((GeneratedObject)go, OT);
            if (OT.typ.Equals(GenObjectType.Drag))
            {
                activePanel.gameObject.SetActive(true);
                activePanel.SetupPanel((GeneratedObject)go);
            }
            if (OT.typ.Equals(GenObjectType.Static))
            {
                staticPanel.gameObject.SetActive(true);
                staticPanel.SetupPanel((ItemSlot)go);
            }
            if (OT.typ.Equals(GenObjectType.Afk))
            {
                staticObrPanel.gameObject.SetActive(true);
                staticObrPanel.SetupPanel(go, OT);
            }
        }
        if (OT.prefabTyp.Equals(PrefabType.Swap))
        {
            klikaciPanel.gameObject.SetActive(true);
            klikaciPanel.SetupPanel((ClickableObject)go, OT);
        }
        if (OT.prefabTyp.Equals(PrefabType.Text))
        {
            textPanel.gameObject.SetActive(true);
            textPanel.SetupPanel(OT, (ItemSlot)go);
            tvarPanel.gameObject.SetActive(true);
            tvarPanel.SetupPanel(OT.img, go.rectTransform, OT, go);
        }
    }
Esempio n. 10
0
    public void CreateObj()
    {
        GameObject go = Instantiate(selected, spawnArea.transform);
        ObjectT    OT = go.AddComponent <ObjectT>();

        OT.prefabTyp = prefabType;
        switch (type)
        {
        case GenObjectType.Drag:
            DragDrop dg = go.AddComponent <DragDrop>();
            dg.DisableMovement();
            OT.SetTyp(GenObjectType.Drag, icons[0]);
            if (OT.prefabTyp.Equals(PrefabType.Tvar))
            {
                AssignId(dg, OT);
                dg.type = "Drag";
            }
            if (OT.prefabTyp.Equals(PrefabType.Basic))
            {
                AssignId(dg, OT);
                dg.type    = "Drag";
                dg.imageID = 900;
            }
            break;

        case GenObjectType.Click:
            ClickableObject co = go.AddComponent <ClickableObject>();
            OT.SetTyp(GenObjectType.Click, icons[1]);
            co.imgFace     = new List <Texture2D>(basicTextures);
            co.img.texture = basicTextures[0];
            co.type        = "Click";
            OT.prefabTyp   = PrefabType.Swap;
            co.editor      = true;
            break;

        case GenObjectType.Static:
            ItemSlot itemslot = go.AddComponent <ItemSlot>();
            OT.SetTyp(GenObjectType.Static, icons[2]);
            if (prefabType.Equals(PrefabType.Tvar))
            {
                itemslot.img.color   = Color.gray;
                itemslot.img.texture = rectangleText;
                itemslot.objectName  = "Static tvar " + staticContextID;
                itemslot.type        = "Stat";
                staticContextID++;
            }
            if (prefabType.Equals(PrefabType.Basic))
            {
            }
            break;

        case GenObjectType.Afk:
            OT.SetTyp(GenObjectType.Afk, icons[2]);
            ItemSlot itemSlot = go.AddComponent <ItemSlot>();
            itemSlot.contextID  = -999;
            itemSlot.imageID    = -999;
            itemSlot.objectName = "Statický obj";
            itemSlot.type       = "Afk";
            itemSlot.editor     = true;
            break;
        }
        ObjectModificator.Instance.SelectObject(OT.GetComponent <GeneratedObject>(), OT);
    }
Esempio n. 11
0
 public void SetupGalery(ObjectT objectT, GeneratedObject go)
 {
     this.objectT         = objectT;
     this.generatedObject = go;
     selectedArray        = zvierata;
 }
Esempio n. 12
0
 public void SetupPanel(ClickableObject clickableObject, ObjectT objectT)
 {
     this.objectT         = objectT;
     this.clickableObject = clickableObject;
     UpdatePanel();
 }