Пример #1
0
    public void DropToEquip()
    {
        if (GameManager.draggingObject)
        {
            GenericDataHandler data     = GameManager.draggedObject.GetComponent <GenericDataHandler>();
            GenericDataHandler thisSlot = GetComponent <GenericDataHandler>();

            /*Entity.Ship ship = FLFlight.Ship.PlayerShip.ShipEntity;
             * if (data != null)
             * {
             *  int slotIdx = int.Parse(thisSlot.getData("slotIdx"));
             *
             *  string thisSlotType = thisSlot.getData("slotType");
             *  string draggedType = data.getData("slotType");
             *
             *
             *
             *  string uuid = data.getData("equippedItem.UUID");
             *
             *  if(thisSlotType == draggedType)
             *  {
             *      FLFlight.Ship.PlayerShip.equipSlot(uuid, slotIdx);
             *      ship.RemoveCargo(uuid, 1);
             *  }
             *
             *
             *
             * }*/
        }
    }
Пример #2
0
    // Start is called before the first frame update
    //SHOW # items. adjust how big viewport is.
    //Font to use. Maybe not for this particular script but in the prefab.

    public void fill()
    {
        dataHandler = GetComponent <GenericDataHandler>();
        display     = GetComponent <displayObjDetails>();
        foreach (DataFieldMap mapping in FieldMapping)
        {
            Text text = mapping.obj.GetComponent <Text>();
            if (text == null)
            {
                Image    img     = mapping.obj.GetComponent <Image>();
                int      idx     = int.Parse(mapping.data.getFieldFromItemID(index.ToString(), mapping.fieldName));
                Sprite[] sprites = Resources.LoadAll <Sprite>("GUIicons/" + spriteSheet.name);
                img.sprite = sprites[idx];
            }
            else
            {
                text.text = mapping.data.getFieldFromItemID(index.ToString(), mapping.fieldName);
            }
        }
        dataHandler.setData(data.getFieldsFromItemID(index));
        display.displayCode = data.displayCode;

        /*opdown = GetComponent<Dropdown>();
         * dropdown.ClearOptions();
         *
         * //need to pair id to value when selecting.
         * Dictionary<string,string> opts= data.getFieldFromAllItemsKeyed(chosenField,true,true);
         * //options.Add("");//add extra at bottom because dropdown hides it.
         * optionKeys = opts.Values.ToList();
         * dropdown.AddOptions(opts.Keys.ToList());*/
    }
Пример #3
0
    private void Start()
    {
        dataHandler = GetComponent <GenericDataHandler>();
        display     = GetComponent <displayObjDetails>();

        initData();
    }
    //USE STRING TO HANDLE WHAT TO DISPLAY!!!!!
    //ex:
    //equippedItem.RateOfFire
    //equippedItem.ProjectileSpeed


    // Start is called before the first frame update
    private void Reset()
    {
        GenericDataHandler h = GetComponent <GenericDataHandler>();

        if (h == null)
        {
            gameObject.AddComponent <GenericDataHandler>();
        }
    }
    void Start()
    {
        comparisons = new Dictionary <string, string>();
        data        = GetComponent <GenericDataHandler>();
        if (uiObject == null)
        {
            uiObject = MenuManager.ins.detailsCard.GetComponentInChildren <listObjProps>();
        }

        Invoke("Init", 0.1f);
        InvokeRepeating("uiUpdate", updateTick, updateTick);
    }
Пример #6
0
    public void displayValFields(int chosen)
    {
        GenericDataHandler datah = GetComponent <GenericDataHandler>();
        // listObjProps uiObject = displayObj;

        //string key = this.optionKeys[chosen];


        //Dictionary<string, string> dat = data.getFieldsFromItemID(key);

        //uiObject.resetVals();

        //parseFields(key);
    }
Пример #7
0
    public void DropToCargo()
    {
        if (GameManager.draggingObject)
        {
            GenericDataHandler data = GameManager.draggedObject.GetComponent <GenericDataHandler>();

            /*Entity.Ship ship = FLFlight.Ship.PlayerShip.ShipEntity;
             * if(data != null)
             * {
             *  int slotIdx = int.Parse(data.getData("slotIdx"));
             *
             *  equipmentSlot slot = ship.getEquipmentSlot(slotIdx);
             *  ship.AddCargo(slot.equippedItem,1,slot.slotType);
             *  FLFlight.Ship.PlayerShip.unequipSlot(slotIdx);
             * }*/
        }
    }
Пример #8
0
    public void displayValFields(int chosen)
    {
        GenericDataHandler datah    = GetComponent <GenericDataHandler>();
        listObjProps       uiObject = displayObj;

        string key = this.optionKeys[chosen];


        Dictionary <string, string> dat = data.getFieldsFromItemID(key);

        uiObject.resetVals();


        dataHandler.setData(data.getFieldsFromItemID(key));
        display.uiObject    = displayObj;
        display.displayCode = data.displayCode;
        display.parseFields();
    }
Пример #9
0
 // Start is called before the first frame update
 void Start()
 {
     originalPosition = uiObject.transform.position;
     data             = GetComponent <GenericDataHandler>();
 }