Example #1
0
    // Token: 0x06002F50 RID: 12112 RVA: 0x000E5E1C File Offset: 0x000E421C
    public void OnBeginDrag(PointerEventData eventData)
    {
        Canvas canvas = DragMe.FindInParents <Canvas>(base.gameObject);

        if (canvas == null)
        {
            return;
        }
        this.m_DraggingIcon = new GameObject("icon");
        this.m_DraggingIcon.transform.SetParent(canvas.transform, false);
        this.m_DraggingIcon.transform.SetAsLastSibling();
        Image image = this.m_DraggingIcon.AddComponent <Image>();

        this.m_DraggingIcon.AddComponent <IgnoreRaycast>();
        image.sprite = base.GetComponent <Image>().sprite;
        image.SetNativeSize();
        if (this.dragOnSurfaces)
        {
            this.m_DraggingPlane = (base.transform as RectTransform);
        }
        else
        {
            this.m_DraggingPlane = (canvas.transform as RectTransform);
        }
        this.SetDraggedPosition(eventData);
    }
Example #2
0
    public void DropBaseAction(PointerEventData eventData)
    {
        if (eventData == null || eventData.pointerDrag == null)
        {
            return;
        }
        DragMe originDragMe = eventData.pointerDrag.GetComponent <DragMe>();

        if (originDragMe == null || originDragMe.m_DraggingObj == null)
        {
            return;
        }

        dragImage.sprite = originDragMe.dragImage.sprite;

        if (dragChildren.Count > 0 && originDragMe.dragChildren.Count > 0)
        {
            for (int i = 0; i < originDragMe.dragChildren.Count; i++)
            {
                if (dragChildren.Count > i)
                {
                    SetChildren(originDragMe.dragChildren[i], dragChildren[i]);
                }
            }
        }
        dragImage.gameObject.SetActive(true);
    }
 void Start()
 {
     dragme = GetComponent <DragMe>();
     rb     = GetComponent <Rigidbody>();
     audio  = GetComponent <AudioSource>();
     CalibrateAccelerometer();
 }
Example #4
0
    // Use this for initialization
    void Start()
    {
        GameObject parent = transform.parent.gameObject;

        dm = parent.GetComponent <DragMe>();
        otherParentTransform = null;
        otherPos             = Vector3.zero;
    }
Example #5
0
    private void GetDropSprite(PointerEventData data)
    {
        var originalObj = data.pointerDrag;

        Debug.Log(originalObj.name);
        DragMe dm = originalObj.GetComponent <DragMe>();

        holder.SetItemPiece(dm.itemData);
    }
Example #6
0
    public void OnEnable()
    {
        localDragMe = GetComponent <DragMe>();

        if (localDragMe.itemData != null)
        {
            containerImage.color = HiddenColor;
            SetWeaponImageToInvenotryIcon();
        }
    }
Example #7
0
    // Use this for initialization
    void Awake()
    {
        DragMe dragMe  = transform.Find("drag").GetComponent <DragMe>();
        DragMe dragMe1 = transform.Find("drag1").GetComponent <DragMe>();
        DragMe dragMe2 = transform.Find("drop").GetComponent <DragMe>();

        dragItemList.Add(dragMe);
        dragItemList.Add(dragMe1);
        dragItemList.Add(dragMe2);
        setCallBack();
    }
Example #8
0
    private void SwichIconsAndAttachments(DragMe localDragMe)
    {
        var localSprite        = GetComponent <Image>().sprite;
        var localShipAttacment = localDragMe.itemData;

        localDragMe.itemData  = dragMe.itemData;
        containerImage.sprite = dragMe.GetComponent <Image>().sprite;

        dragMe.itemData = localShipAttacment;
        dragMe.GetComponent <Image>().sprite = localSprite;
    }
Example #9
0
 void FillShopItems(List <Item> shopItems)
 {
     ClearGrid();
     foreach (Item item in shopItems)
     {
         GameObject itemInstance = Instantiate(itemPrefab, gridRect);
         DragMe     shopItem     = itemInstance.GetComponent <DragMe>();
         shopItem.SetData(sender, mainCanvas, item);
         shopItem.icon.sprite = item.itemGraphic;
         entries.Add(shopItem);
     }
 }
Example #10
0
        /// <summary>
        /// Applied after OnEndDrag runs.
        /// </summary>
        internal static void Postfix(DragMe __instance)
        {
            GameObject go;

            if (__instance != null && (go = __instance.gameObject) != null)
            {
                var vs = go.GetComponentInParent <VirtualScroll>();
                if (vs != null)
                {
                    vs.ClearForceShow(go);
                }
            }
        }
Example #11
0
    public bool AllowDropped(DragMe dragMe)
    {
        InventoryItem item = dragMe.GetComponent <InventoryItem>();

        if (item != null)
        {
            if (item.ItemType == allowDropType)
            {
                return(true);
            }
        }

        return(false);
    }
Example #12
0
 static int OnEndDrag(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DragMe obj = (DragMe)ToLua.CheckObject(L, 1, typeof(DragMe));
         UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2, typeof(UnityEngine.EventSystems.PointerEventData));
         obj.OnEndDrag(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #13
0
    static int get_dragOnSurfaces(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            DragMe obj = (DragMe)o;
            bool   ret = obj.dragOnSurfaces;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index dragOnSurfaces on a nil value" : e.Message));
        }
    }
Example #14
0
    static int set_dragOnSurfaces(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            DragMe obj  = (DragMe)o;
            bool   arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.dragOnSurfaces = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index dragOnSurfaces on a nil value" : e.Message));
        }
    }
    // Use this for initialization
    void Start()
    {
        Button button = GetComponent <Button>();

        button.onClick.AddListener(OnItemClicked);

        ItemData data = MainController.Instance.GetItemData(itemType);

        targetImage.sprite = data.sprite;
        targetImage.SetNativeSize();

        dragMe = transform.EnsureComponent <DragMe>();
        dragMe.actionDragFinished += OnDropFinished;
        dragMe.enabled             = false;

        this.ItemLocation = Location.FindWindow;
    }
Example #16
0
 public void ReboundBaseAction(PointerEventData eventData)
 {
     if (eventData.pointerDrag != null)
     {
         DragMe originDragMe = eventData.pointerDrag.GetComponent <DragMe>();
         if (originDragMe == null)
         {
             return;
         }
         //originDragMe.dragImage.sprite = null;
         //for (int i = 0; i < originDragMe.dragChildren.Count; i++)
         //{
         //    originDragMe.dragChildren[i].sprite = null;
         //}
         originDragMe.dragImage.gameObject.SetActive(true);
     }
 }
Example #17
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        Canvas inParents = DragMe.FindInParents <Canvas>(this.gameObject);

        if ((Object)inParents == (Object)null)
        {
            return;
        }
        this.m_DraggingIcons[eventData.pointerId] = new GameObject("icon");
        this.m_DraggingIcons[eventData.pointerId].transform.SetParent(inParents.transform, false);
        this.m_DraggingIcons[eventData.pointerId].transform.SetAsLastSibling();
        Image image = this.m_DraggingIcons[eventData.pointerId].AddComponent <Image>();

        this.m_DraggingIcons[eventData.pointerId].AddComponent <CanvasGroup>().blocksRaycasts = false;
        image.sprite = this.GetComponent <Image>().sprite;
        image.SetNativeSize();
        this.m_DraggingPlanes[eventData.pointerId] = !this.dragOnSurfaces ? inParents.transform as RectTransform : this.transform as RectTransform;
        this.SetDraggedPosition(eventData);
    }
    public void OnLongClick(PointerEventData lastEventData)
    {
        mLauncherController.Log(TAG, "OnLongClick: lastEventData.position=" + lastEventData.position);
        DestroySelectedBackground();
        RectTransform rt   = gameObject.GetComponent <RectTransform> ();
        float         posZ = LauncherController.ICON_RISING_DISTANCE;

        mLauncherController.Log(TAG, "OnLongClick: AnchorPos3D=" + rt.anchoredPosition3D);
        Vector3 toPos = new Vector3(rt.anchoredPosition3D.x, rt.anchoredPosition3D.y, posZ);
        Tweener tw    = rt.DOAnchorPos3D(toPos, LauncherController.ANIM_DURATION);

        tw.OnComplete(test);
        dragMe = gameObject.AddComponent <DragMe> ();
        dragMe.mLauncherController = mLauncherController;
        dragMe.launcherModel       = mLauncherController.launcherModel;
        dragMe.OnPointerDown(lastEventData);

        TrashController trashController = mLauncherController.trashRange.GetComponent <TrashController> ();

        trashController.Rise();
    }
Example #19
0
    private ShipComponentDataHolder GetShipAttachment(PointerEventData data)
    {
        var originalObj = data.pointerDrag;

        if (originalObj == null)
        {
            return(null);
        }

        dragMe = originalObj.GetComponent <DragMe>();
        if (dragMe == null)
        {
            return(null);
        }

        var srcShipAttachment = dragMe.itemData;

        if (srcShipAttachment == null)
        {
            return(null);
        }

        return(srcShipAttachment);
    }
Example #20
0
    private Sprite GetDropSprite(PointerEventData data)
    {
        var originalObj = data.pointerDrag;

        if (originalObj == null)
        {
            return(null);
        }

        dragMe = originalObj.GetComponent <DragMe>();
        if (dragMe == null)
        {
            return(null);
        }

        var srcImage = originalObj.GetComponent <Image>();

        if (srcImage == null)
        {
            return(null);
        }

        return(srcImage.sprite);
    }
Example #21
0
 void Start()
 {
     rh     = new RaycastHelper(EscenaOle.arCamera);
     dragMe = GetComponent <DragMe>();
 }
    private void BuildDisplay()
    {
        foreach (DisplayedMod displayedMod in displayedMods)
        {
            DisplayedMod current = displayedMod;
            if ((UnityEngine.Object)current.rect_transform != (UnityEngine.Object)null)
            {
                UnityEngine.Object.Destroy(current.rect_transform.gameObject);
            }
        }
        displayedMods.Clear();
        ModOrderingDragListener listener = new ModOrderingDragListener(this, displayedMods);

        for (int i = 0; i != Global.Instance.modManager.mods.Count; i++)
        {
            Mod mod = Global.Instance.modManager.mods[i];
            if (mod.status != 0 && mod.status != Mod.Status.UninstallPending && mod.HasAnyContent(Content.LayerableFiles | Content.Strings | Content.DLL | Content.Animation))
            {
                HierarchyReferences hierarchyReferences = Util.KInstantiateUI <HierarchyReferences>(entryPrefab, entryParent.gameObject, false);
                displayedMods.Add(new DisplayedMod
                {
                    rect_transform = hierarchyReferences.gameObject.GetComponent <RectTransform>(),
                    mod_index      = i
                });
                DragMe component = hierarchyReferences.GetComponent <DragMe>();
                component.listener = listener;
                LocText reference = hierarchyReferences.GetReference <LocText>("Title");
                reference.text = mod.title;
                ToolTip reference2 = hierarchyReferences.GetReference <ToolTip>("Description");
                reference2.toolTip = mod.description;
                if (mod.crash_count != 0)
                {
                    reference.color = Color.Lerp(Color.white, Color.red, (float)mod.crash_count / 3f);
                }
                KButton reference3 = hierarchyReferences.GetReference <KButton>("ManageButton");
                reference3.isInteractable = mod.is_managed;
                if (reference3.isInteractable)
                {
                    reference3.GetComponent <ToolTip>().toolTip = mod.manage_tooltip;
                    reference3.onClick += mod.on_managed;
                }
                MultiToggle toggle = hierarchyReferences.GetReference <MultiToggle>("EnabledToggle");
                toggle.ChangeState(mod.enabled ? 1 : 0);
                MultiToggle multiToggle = toggle;
                multiToggle.onClick = (System.Action)Delegate.Combine(multiToggle.onClick, (System.Action) delegate
                {
                    OnToggleClicked(toggle, mod.label);
                });
                toggle.GetComponent <ToolTip>().OnToolTip = (() => (!mod.enabled) ? UI.FRONTEND.MODS.TOOLTIPS.DISABLED : UI.FRONTEND.MODS.TOOLTIPS.ENABLED);
                hierarchyReferences.gameObject.SetActive(true);
            }
        }
        foreach (DisplayedMod displayedMod2 in displayedMods)
        {
            DisplayedMod current2 = displayedMod2;
            current2.rect_transform.gameObject.SetActive(true);
        }
        if (displayedMods.Count != 0)
        {
            return;
        }
    }