Exemplo n.º 1
0
    public void RemoveItem(Inven item)
    {
        items.Remove(item);



        for (int t = 0; t < textLinks.Count; t++)
        {
            if (textLinks[t].name == item.name)
            {
                Debug.Log("found " + item.name + " in textlinks");

                GameObject.Destroy(textLinks[t]);
                textLinks.RemoveAt(t);
            }
            else
            {
                Debug.Log("did not find" + item.name);
            }
            //Debug.Log(t);
        }


        for (int t = 0; t < textLinks.Count; t++)
        {
            textLinks[t].transform.localPosition = new Vector3(t * 1 * linkDist - totalOffsetLink, 0, 0);
        }
    }
Exemplo n.º 2
0
        static STARTSELECT Town(Player _Player)
        {
            // shopinven 이라는 인벤토리를 만들어줌.
            Inven <Item> ShopInven = new Inven <Item>(5, 5);

            ShopInven.AddItem(new Item("철검", 500), 1);
            ShopInven.AddItem(new Item("천갑옷", 300), 2);
            ShopInven.AddItem(new Item("돌칼", 300), 4);
            ShopInven.AddItem(new Item("녹슨 도끼", 350), 5);
            ShopInven.AddItem(new Item("빨간 포션", 50), 6);
            ShopInven.AddItem(new Item("파란 포션", 30), 10);
            ShopInven.AddItem(new Item("뭔가 수상한 지팡이", 50), 13);
            ShopInven.AddItem(new Item("천갑옷", 300), 16);
            ShopInven.AddItem(new Item("돌칼", 300), 20);
            ShopInven.AddItem(new Item("녹슨 도끼", 350), 21);
            ShopInven.AddItem(new Item("빨간 포션", 50), 22);
            ShopInven.AddItem(new Item("파란 포션", 30), 24);
            ShopInven.AddItem(new Item("파란 포션", 30), 25);


            while (true)
            {
                Console.Clear();
                _Player.StatusRender();

                Console.WriteLine("\n마을에서 무엇을 하시겠습니까?");
                Console.WriteLine("1.여관에 들려 체력을 회복한다.");
                Console.WriteLine("2.대장관에 들른다.");
                Console.WriteLine("3.상점에 들른다.");
                Console.WriteLine("4.마을을 나간다.\n");

                switch (Console.ReadKey().Key)
                {
                case ConsoleKey.D1:
                    Inn(_Player);
                    break;

                case ConsoleKey.D2:
                    break;

                case ConsoleKey.D3:
                    Shop(_Player, ShopInven);
                    break;

                case ConsoleKey.D4:
                    Console.WriteLine("");
                    Console.WriteLine("마을을 나갑니다.\n");
                    Console.ReadKey();

                    // 함수의 분기.
                    // 함수의 통합.
                    // 객체를 선언해야 될 때 이 세개가 초반 프로그래밍의 전부.

                    return(STARTSELECT.NONESELECT);    // 나간다.

                default:
                    break;
                }
            }
        }
Exemplo n.º 3
0
 public void ManageInventory(GameObject clicked)
 {
     //Inventoriado de Objetos - START
     clickedobject = clicked.GetComponent <Clicked> ();
     try {
         if (!IsInInventory(clicked.name))
         {
             if (clickedobject.visible)
             {
                 GameObject Inventario = GameObject.Find("Inventario");
                 Inven      codigo     = Inventario.GetComponent <Inven> ();
                 codigo.AddGO(clickedobject.sprite);
                 //this.gameObject.GetComponent<Renderer> ().enabled = false;
                 clicked.gameObject.SetActive(false);
                 GameObject global = GameObject.Find("ScriptGlobal");
                 Global     sglob  = global.GetComponent <Global> ();
                 sglob.objetoarr(clicked.name);
                 clickedobject.visible = false;
             }
             if (clickedobject.sg.Orbit)
             {
                 clickedobject.isDragging = true;
             }
         }
     } catch {
         Debug.Log("0035");
     }
     //Inventoriado de Objetos - END
 }
Exemplo n.º 4
0
    //  [MenuItem("MysteryBuilder/Make Me")]
    static void Init()
    {
        if (Selection.activeGameObject != null)
        {
            GameObject me = Selection.activeGameObject;
            if (me.GetComponentInChildren <Inv_Collectable>())
            {
                EditorWindow.GetWindow(typeof(InventoryEditor));

                Inven           asset = (Inven)ScriptableObject.CreateInstance(typeof(Inven));
                Inv_Collectable thing = me.GetComponentInChildren <Inv_Collectable>();
                string          path  = "Assets/i_" + thing.name + ".asset";
                Debug.Log(thing.gameObject.GetComponent <SpriteRenderer>().sprite + " hey ");
                asset.message     = thing.lookMessage;
                asset.objectImage = thing.GetComponent <SpriteRenderer>().sprite;
                AssetDatabase.CreateAsset(asset, path);
                AssetDatabase.SaveAssets();
                EditorUtility.FocusProjectWindow();
                thing.item = asset;

                Selection.activeObject = asset;
            }
            else
            {
                EditorUtility.DisplayDialog("No Collectable Object to Inventorize.", "Please select an GameObject that has been run thorugh the Make Collectable process.", "ok boss");
            }
        }
        else
        {
            EditorUtility.DisplayDialog("No Object to Collectify", "Select Sprite Gameobject in the Hierarchy to make it an inventory collectable.", "ok boss");
        }
    }
    /* 씨앗 심기 */
    void PlantingProcess()
    {
        if (!m_BlockManager.IS_Focus)
        {
            return;
        }

        // 블록 포커스 상태에서 마우스 클릭
        else
        {
            if (Input.GetMouseButtonDown(0))
            {
                if (m_BlockManager.Hit_Info.transform.tag != "FarmLand")
                {
                    return;
                }
                // 씨앗 개수 부족
                if (Inven.MySeedCount <= 0)
                {
                    Text temptext = GameObject.Instantiate(EventMgr.ErrorMsg);
                    temptext.transform.SetParent(EventMgr.transform);
                    temptext.transform.localPosition = Vector3.up * 300f;
                    temptext.transform.localScale    = Vector3.one;
                    StartCoroutine(ErrorMsg.ErrorMsgCoroutine(temptext, EventMgr.SeedErrorMsg));
                    return;
                }

                ObjectManagement(Seed);
                --Inven.MySeedCount;
                Inven.UpdateInvenUI();
            }
        }
    }
Exemplo n.º 6
0
        static STARTSELECT Town(Player _Player)
        {
            Inven ShopInven = new Inven(5, 3);

            ShopInven.ItemIn(new Item("Iron Sword", 500));
            ShopInven.ItemIn(new Item("Iron Shield", 500));

            while (true)
            {
                Console.Clear();
                _Player.StatusRender();
                Console.WriteLine("What do you want to do in this town?");
                Console.WriteLine("1. Taking a rest");
                Console.WriteLine("2. Visiting Merchants");
                Console.WriteLine("3. Getting out of the twon");

                //ConsoleKey CK = Console.ReadKey().Key;
                switch (Console.ReadKey().Key)
                {
                case ConsoleKey.D1:
                    _Player.MaxHeal();
                    _Player.PrintHP();
                    break;

                case ConsoleKey.D2:
                    Shop(_Player, ShopInven);
                    break;

                case ConsoleKey.D3:
                    return(STARTSELECT.NONSELECT);
                }
            }
        }
Exemplo n.º 7
0
        // Inven.SelectIndex = 100;
        // SelectIndex = 100;
        // public void Test2()
        // {
        //    SelectIndex = 100;
        // }
        // 이건 안됨. 설령 SelectIndex가 public이어도 안됨.
        // 왜냐 : 이너클래스는 자식 클래스와 다름.
        // 자식클래스처럼 부모클래스의 필드를 가지고 있는게 아니다.
        // InvenSlot이란 클래스에 SelectIndex라는 필드는 없다.

        public void InnerTest(Inven _inven)
        {
            _inven.SelectIndex = 100;
            Inven.TestNumb     = 2;
            TestNumb           = 1;
            SelectIndex        = 10;
        }
    // Start is called before the first frame update
    void Awake()
    {
        EventTrigger_Init();

        m_Inven    = GameObject.Find("Inven").GetComponent <Inven>();
        m_Crafting = GameObject.Find("Crafting").GetComponent <Crafting>();
    }
Exemplo n.º 9
0
 public static void Clear()
 {
     Sound.Clear();
     Scene.Clear();
     UI.Clear();
     Pool.Clear();
     Inven.Clear();
 }
Exemplo n.º 10
0
    void Start()
    {
        GameMgr     = GameObject.Find("GameMGR").GetComponent<GameMGR>();
        Inventory   = GameObject.Find("UI Root/Camera/Inventory").GetComponent<Inven>();

        // 기본 활성화 탭을 all로 설정
        ChangeSprite(ITEM_TYPE.ALL);
    }
Exemplo n.º 11
0
 void Reset()
 {
     lookMessage         = "";
     touchMessage        = "";
     afterCollectMessage = "";
     destroyOnCollect    = true;
     spriteSwitch        = null;
     item = null;
 }
Exemplo n.º 12
0
    public static void CreateAsset(Inven asset, string name)
    {
        string path = "Assets/" + name + ".asset";

        AssetDatabase.CreateAsset(asset, path);
        AssetDatabase.SaveAssets();
        EditorUtility.FocusProjectWindow();
        Selection.activeObject = asset;
    }
Exemplo n.º 13
0
 public Monster(string _Name, int _AT, int _HP, int _MAXHP, int _ItemX, Item _Item)
 {
     Name      = _Name;
     AT        = _AT;
     HP        = _HP;
     MAXHP     = _MAXHP;
     Inventory = new Inven(_ItemX, 1);
     Inventory.Insert(_Item);
 }
Exemplo n.º 14
0
 // Use this for initialization
 void Start()
 {
     visible  = true;
     scriglo  = GameObject.Find("ScriptGlobal");
     sg       = scriglo.GetComponent <Global> ();
     scriglo2 = GameObject.Find("Inventario");
     sg2      = scriglo2.GetComponent <Inven> ();
     cm       = GameObject.Find("CamaraOrbit");
     c        = cm.GetComponent <Camera> ();
 }
Exemplo n.º 15
0
    static void Main(string[] args)
    {
        Player NewPlayer = new Player();


        Inven NewInven = new Inven();

        NewInven.InnerClassTest();

        Inven.INVENDIR IDIR = Inven.INVENDIR.ID_LEFT;
    }
Exemplo n.º 16
0
 public bool CheckItem(Inven item)
 {
     if (items.Contains(item))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 17
0
    public void addItem(Inven item)
    {
        GameObject linkGO = (GameObject)Instantiate(textLinkPrefab);

        linkGO.GetComponent <Image>().sprite = item.objectImage;
        linkGO.name = item.name;
        // linkGO.transform.parent = this.transform;
        linkGO.transform.SetParent(this.transform);
        linkGO.transform.localPosition = new Vector3(items.Count * 1 * linkDist - totalOffsetLink, 0, 0);
        linkGO.transform.localScale    = Vector3.one;
        textLinks.Add(linkGO);
        items.Add(item);
    }
Exemplo n.º 18
0
 static void Shop(Player _Player, Inven _ShopInven)
 {
     while (true)
     {
         Console.Clear();
         Console.WriteLine("-------------------------");
         Console.WriteLine("Shopper's List");
         _ShopInven.Render();
         Console.WriteLine("-------------------------");
         Console.WriteLine("Player's List");
         _Player.PInven.Render();
         Console.ReadKey();
     }
 }
Exemplo n.º 19
0
    static void Main(string[] args)
    {
        Inven NewInven = new Inven(5, 3);

        Item NewItem = new Item("IronSword", 100);


        //뭐가 있어야 겠다
        //클래스 속성들이 있다
        //아이템 배열을 멤버변수로 가졌다
        //인벤에 아이템을 넣는다

        NewInven.ItemIn(new Item("IronSword", 100));
        NewInven.ItemIn(new Item("IronShield", 100));

        NewInven.ItemIn(new Item("Potion", 100), 6);



        while (true)
        {
            Console.Clear();

            NewInven.Render();

            ConsoleKeyInfo CheckKey = Console.ReadKey();

            switch (CheckKey.Key)
            {
            case ConsoleKey.LeftArrow:
                NewInven.SelectMoveLeft();
                break;

            case ConsoleKey.RightArrow:
                NewInven.SelectMoveRight();
                break;

            case ConsoleKey.UpArrow:
                NewInven.SelectMoveUp();
                break;

            case ConsoleKey.DownArrow:
                NewInven.SelectMoveDown();
                break;

            default:
                break;
            }
        }
    }
Exemplo n.º 20
0
        static void Main(string[] args)
        {
            Inven inven = new Inven(5, 3);

            inven.addItem(new Item("철검", 500));
            inven.addItem(new Item("갑옷", 700));


            while (true)
            {
                inven.Render();
                inven.selectMove(Console.ReadKey().Key);
                Console.Clear();
            }
        }
Exemplo n.º 21
0
    public override void OnInspectorGUI()
    {
        EditorGUILayout.HelpBox("Let's try it", MessageType.None);
        me = (Inven)target;



        me.objectImage = (Sprite)EditorGUILayout.ObjectField("Sprite:", me.objectImage, typeof(Sprite), true);


        //(Sprite)EditorGUILayout.ObjectField( "Sprite",me.objectImage, typeof(Sprite));
        me.message = GUILayout.TextArea(me.message);



        //   GUILayout.Label("This is a Label in a Custom Editor");

        //thisTarget.isLootable = EditorGUILayout.Toggle("Is Lootable", thisTarget.isLootable);
        //thisTarget.animateWhenLooting = EditorGUILayout.Toggle("Animate When Looting", thisTarget.animateWhenLooting);

        //EditorGUILayout.HelpBox("Let's try it", MessageType.Info);

        //GUILayout.Label("Fades Don't Work");
        //EditorGUILayout.BeginFadeGroup(0);

        //GUILayout.FlexibleSpace();



        //me.destroyWhenEmpty = EditorGUILayout.Toggle("Destroy When Empty", thisTarget.destroyWhenEmpty);
        //if (me.destroyWhenEmpty)
        //{
        //    me.delayBeforeDestroying = EditorGUILayout.FloatField("Delay Before Destroying", thisTarget.delayBeforeDestroying);
        //    me.fadeBeforeDestroying = EditorGUILayout.Toggle("Fade Before Destroying", thisTarget.fadeBeforeDestroying);
        //    me.fadeDuration = EditorGUILayout.FloatField("Fade Duration", thisTarget.fadeDuration);
        //}



        // Editor



        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
Exemplo n.º 22
0
    public void addItem(Inven item)
    {
        GameObject linkGO = (GameObject)Instantiate(textLinkPrefab);

        linkGO.GetComponent <Image>().sprite = item.objectImage;
        linkGO.name = item.name;
        linkGO.transform.SetParent(this.transform);
        linkGO.transform.localPosition = new Vector3(items.Count * 1 * linkDist - totalOffsetLink, 0, 0);
        linkGO.transform.localScale    = Vector3.one;
        linkGO.GetComponent <Inv_Interact>().message = item.message;
        linkGO.GetComponent <Inv_Interact>().cursor  = item.objectImage.texture;
        linkGO.GetComponent <Inv_Interact>().item    = item;
        Debug.Log(linkGO.GetComponent <Inv_Interact>().item.name + item.name);
        textLinks.Add(linkGO);
        items.Add(item);
    }
Exemplo n.º 23
0
        public Player(string _Name, UNITCLASS _Class)
        {
            Name      = _Name;
            UnitClass = _Class;
            switch (UnitClass)
            {
            case UNITCLASS.KNIGHT:
                AT        = 10;
                HP        = 10;
                MAXHP     = 100;
                Inventory = new Inven(5, 5);
                Inventory.Insert(new Item("롱소드", 200, 50));
                break;

            case UNITCLASS.WIZARD:
                AT        = 7;
                HP        = 50;
                MAXHP     = 50;
                Inventory = new Inven(5, 5);
                Inventory.Insert(new Item("완드", 500, 100));
                break;

            case UNITCLASS.THIEF:
                AT        = 8;
                HP        = 80;
                MAXHP     = 80;
                Inventory = new Inven(5, 10);
                Inventory.Insert(new Item("복면", 0, 0));
                break;

            case UNITCLASS.PRIEST:
                AT        = 5;
                HP        = 50;
                MAXHP     = 50;
                Inventory = new Inven(5, 5);
                Inventory.Insert(new Item("성서", 300, 200));
                break;
            }
        }
Exemplo n.º 24
0
    static void Main(string[] args)
    {
        Inven NewInven = new Inven(5, 3);

        Item NewItem1 = new Item("철검", 100);
        Item NewItem2 = new Item("천갑옷", 100);
        Item NewItem3 = new Item("바나나", 100);

        //이제 인벤에 아이템을 넣고 싶다.



        NewInven.AddItem(NewItem1);
        NewInven.AddItem(NewItem2);
        NewInven.AddItem(NewItem3);

        NewInven.AddItem(new Item("파란포션", 100), 5);
        // 알아서 처리해줄거라는 생각 자체를 하지 말라.
        // 방어 코드를 설계!!



        while (true)
        {
            // 이런 객체간의 구조를 만들 때 약간 도움이 될만한 규칙들. solid.
            // SOLID : 객체지향 개발 5대 원리.
            // 1. 단일책임의 원칙
            // 2. 개방폐쇄
            // 3. 어쩌구 치환
            // 4. 인터페이스 분리 // 이거 말할라고.
            // 5. 의존성역젼
            //
            // 인터페이스 분리원칙은
            // ex) 함수를 잘개 쪼개서 만든다음에
            // 그 잘게 쪼갠 함수들을 조합해서 새 기능을 만들어 내라. 예 : get(), set(), Damage() 등등
            NewInven.Render();
            NewInven.Select();
        }
    }
Exemplo n.º 25
0
 // Start is called before the first frame update
 void Awake()
 {
     iv         = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inven>();
     DefaultImg = transform.GetComponent <SpriteRenderer>().sprite;
 }
Exemplo n.º 26
0
    void MakeCollectable()
    {
        //string lookMessage = "It's nice to look at.";

        GameObject me = Selection.activeGameObject;

        me.AddComponent <CircleCollider2D>();
        me.GetComponent <CircleCollider2D>().radius   += 0.5f;
        me.GetComponent <CircleCollider2D>().isTrigger = true;
        me.AddComponent <Rigidbody2D>();
        me.GetComponent <Rigidbody2D>().gravityScale = 0;
        me.tag = "Look";

        me.AddComponent <Inv_Controller>();
        me.AddComponent <Inv_Collectable>();



        GameObject mom = new GameObject();

        mom.name = nameDude;


        GameObject sister = new GameObject();

        sister.name = "WalkPoint";

        sister.AddComponent <CircleCollider2D>();
        sister.GetComponent <CircleCollider2D>().isTrigger = true;
        sister.AddComponent <Rigidbody2D>();
        sister.GetComponent <Rigidbody2D>().gravityScale = 0;
        sister.AddComponent <Seperate_Hitbox>();
        Inv_Collectable info;

        info = me.GetComponent <Inv_Collectable>();
        sister.GetComponent <CircleCollider2D>().radius = me.GetComponent <CircleCollider2D>().radius;
        sister.AddComponent <MakeWalkable>();

        sister.transform.SetParent(mom.transform);
        me.transform.SetParent(mom.transform);

        if (!AssetDatabase.IsValidFolder("Assets/Inventory"))
        {
            string guid          = AssetDatabase.CreateFolder("Assets", "Inventory");
            string newFolderPath = AssetDatabase.GUIDToAssetPath(guid);
        }

        Inven  asset = (Inven)ScriptableObject.CreateInstance(typeof(Inven));
        string path  = "Assets/Inventory/i_" + nameDude + ".asset";

        asset.message     = lookMessage;
        asset.objectImage = me.GetComponent <SpriteRenderer>().sprite;
        AssetDatabase.CreateAsset(asset, path);
        AssetDatabase.SaveAssets();
        EditorUtility.FocusProjectWindow();

        // Populate Info
        info.altRadius        = sister.transform;
        info.touchMessage     = touchMessage;
        info.item             = asset;
        info.lookMessage      = lookMessage;
        info.destroyOnCollect = destroyOnCollect;


        Selection.activeObject = me;
    }
Exemplo n.º 27
0
        // 상점 물건 고르기(구매 모드) , 내 물건 고르기(판매 모드) 까지만 구현.
        // 실제 구매 / 판매 아직 미구현.
        static void Shop(Player _Player, Inven <Item> _ShopInven)
        {
            Console.Clear();
            Console.WriteLine("--------상점---------");
            _ShopInven.Render();
            Console.WriteLine("---------------------");
            Console.WriteLine("--------Player-------");
            _Player.Pro_PlayerInven.Render();
            Console.WriteLine("---------------------");
            Console.WriteLine("\n상점주인 : 안녕하신가.");
            Console.ReadKey();


            // shop 내부에서 사용할 TmpMode 인수 -> 구매/판매 모드
            SHOP_MODE TmpMode = SHOP_MODE.BUYING;

            // Tmp모드를 변경하기 위한 _Input. 실제 입력키를 받는 인수.
            Inven <Item> .INVEN_INPUT _Input = Inven <Item> .INVEN_INPUT.CONTINUE;


            while (true)
            {
                Console.Clear();
                Console.WriteLine("--------상점---------");
                _ShopInven.Render();
                Console.WriteLine("---------------------");
                Console.WriteLine("--------Player-------");
                _Player.Pro_PlayerInven.Render();
                Console.WriteLine("---------------------");
                // 첫인사를 한번만 했으면 좋겠다
                // 1. 코인을 하나 넣어서 처음인지 가린다.
                // 2 위에 말을 밖으로 복사한다.
                // Console.WriteLine("\n상점주인 : 안녕하신가. ");
                // 둘다 비효율적인 것 같은데..
                switch (TmpMode)
                {
                // 물건을 산다 -> 상점의 물건을 player가 add하고 상점의 물건을 지운다.
                case SHOP_MODE.BUYING:
                    Console.WriteLine("상점주인 : 그래. 뭐가 필요한가? \n");
                    Console.WriteLine("Enter : 이거 주세요.");
                    Console.WriteLine("Space : 팔 게 있는데.. ");
                    Console.WriteLine("ESC   : 안녕히.");

                    _Input = _ShopInven.Input();
                    switch (_Input)
                    {
                    case Inven <Item> .INVEN_INPUT.CHANGE:
                    {
                        TmpMode = SHOP_MODE.SELLING;             // selling 모드 로 바꾼다.
                        continue;
                    }

                    case Inven <Item> .INVEN_INPUT.CONTINUE:
                    {
                        TmpMode = SHOP_MODE.BUYING;             // BUYING을 다시 넣어준다.
                    }
                    break;

                    case Inven <Item> .INVEN_INPUT.SELECT:
                    {
                        TmpMode = SHOP_MODE.BUYING;
                        Inven <Item> .ExchangeItem(_Player.Pro_PlayerInven, _ShopInven, _ShopInven.GetSelectIndex());
                    }
                    break;

                    case Inven <Item> .INVEN_INPUT.OUT:
                    {
                        TmpMode = SHOP_MODE.OUT;
                    }
                    break;

                    default:
                        break;
                    }
                    break;

                case SHOP_MODE.SELLING:
                    Console.WriteLine("상점주인 : 무엇을 팔고싶나? \n");
                    Console.WriteLine("Enter : 이거 팔게요.");
                    Console.WriteLine("Space : 살 게 있는데.. ");
                    Console.WriteLine("ESC   : 안녕히.");
                    _Input = _Player.Pro_PlayerInven.Input();
                    switch (_Input)
                    {
                    case Inven <Item> .INVEN_INPUT.CHANGE:
                    {
                        TmpMode = SHOP_MODE.BUYING;             // selling 모드 로 바꾼다.
                        continue;
                    }

                    case Inven <Item> .INVEN_INPUT.CONTINUE:
                    {
                        TmpMode = SHOP_MODE.SELLING;             // BUYING을 다시 넣어준다.
                    }
                    break;

                    case Inven <Item> .INVEN_INPUT.SELECT:
                    {
                        TmpMode = SHOP_MODE.SELLING;
                        Inven <Item> .ExchangeItem(_ShopInven, _Player.Pro_PlayerInven, _Player.Pro_PlayerInven.GetSelectIndex());
                    }
                    break;

                    case Inven <Item> .INVEN_INPUT.OUT:
                    {
                        TmpMode = SHOP_MODE.OUT;
                    }
                    break;

                    default:
                        break;
                    }
                    break;

                case SHOP_MODE.OUT:
                    Console.WriteLine("상점주인 : 벌써 가나? 조심히 들어가게.\n");
                    _Player.Pro_PlayerInven.SelectIndex_Initialization();
                    _ShopInven.SelectIndex_Initialization();
                    Console.ReadKey();
                    return;

                default:
                    break;
                }
            }
        }
Exemplo n.º 28
0
 static public void ExchangeItem(Inven <ItemType> _Costomer, Inven <ItemType> _Seller, int _ItemIndex) // 일단 GOLD 없이.
 {                                                                                                     // 인자값과 반환값으로밖에 메소드끼리 소통하지 못한다는게 아쉽다.
     _Costomer.AddItem(_Seller.GetItem(_ItemIndex));
     _ItemIndex = 10;
     _Seller.DeleteItem(_ItemIndex);
 }
Exemplo n.º 29
0
    public void Resolve(string nomm)
    {
        if (Orbit)
        {
            GameObject objeto = DevolverGO(nomm);
            Debug.Log(nomm + "0043");
            Debug.Log(objeto.name + "2111");
            if (nowOrbitingName != "")
            {
                GameObjectFinder(nowOrbitingName).SetActive(false);
            }
            nowOrbitingName = "";
            nowOrbitingName = objeto.name;
            objeto.gameObject.SetActive(true);
            GameObject cam    = GameObject.Find("CamaraOrbit");
            Camera     camara = cam.GetComponent <Camera> ();
            camara.GetComponent <Camera> ().depth = 5;
            GameObject o = GameObject.Find("Orbiting");
            Debug.Log(objeto.transform.position.ToString());
            Debug.Log(o.transform.position.ToString());
            objeto.transform.position = o.transform.position;
            //objeto.GetComponent<Renderer>().enabled=true;
            Debug.Log(objeto.gameObject.transform.position.ToString() + "2058");
            Messenger.Message("Haz click derecho " + "\n" + "para salir", 0.01f, Color.yellow, true, false);
        }
        if (Combinar)
        {
            if (contarobj == 1)
            {
                GameObject bot    = GameObject.Find(nomm);
                NumInt     numint = bot.GetComponent <NumInt>();
                int        nume   = numint.numarray;
                //bot = GameObject.Find(Combinado);
                bot    = GameObjectFinder(Combinado);
                numint = bot.GetComponent <NumInt>();
                int    nume2       = numint.numarray;
                string nuevoobjeto = Unite(Inventario[nume2], Inventario[nume]);
                if (nuevoobjeto != "")
                {
                    //borro imagen, deshabilito botones
                    Inventario[nume]  = "";
                    Inventario[nume2] = "";
                    //GameObject Inventario2 = GameObject.Find (Combinado);
                    GameObject            Inventario2 = GameObjectFinder(Combinado);
                    UnityEngine.UI.Button btn         = Inventario2.GetComponent <UnityEngine.UI.Button> ();
                    btn.interactable = false;
                    btn.image.sprite = default(Sprite);
                    //Inventario2 = GameObject.Find (nomm);
                    Inventario2      = GameObjectFinder(nomm);
                    btn              = Inventario2.GetComponent <UnityEngine.UI.Button> ();
                    btn.interactable = false;
                    btn.image.sprite = default(Sprite);
                    Selected         = "";
                    //pego
                    //GameObject objeton = GameObject.Find(nuevoobjeto);
                    GameObject objeton = GameObjectFinder(nuevoobjeto);
                    //GameObject Inventario1 = GameObject.Find("Inventario");
                    GameObject Inventario1 = GameObjectFinder("Inventario");
                    Clicked    getspr      = objeton.GetComponent <Clicked>();
                    Inven      codigo      = Inventario1.GetComponent <Inven> ();
                    Sprite     sprite      = getspr.sprite;
                    objetoarr(nuevoobjeto);
                    codigo.AddGO(sprite);

                    getspr.visible = false;
                    contarobj      = 0;
                    Combinado      = "";
                    Combinar       = false;
                }
                else
                {
                    Combinar  = false;
                    Combinado = "";
                    contarobj = 0;
                }
            }
            else
            {
                contarobj++;
                Combinado = nomm;
            }
        }
    }
Exemplo n.º 30
0
    void OnGUI()
    {
        GUILayout.Label("Inventory Item Editor", EditorStyles.boldLabel);

        GameObject me = Selection.activeGameObject;

        Inven  asset = (Inven)ScriptableObject.CreateInstance(typeof(Inven));
        string itemName;

        if (me)
        {
            me.name =
                EditorGUILayout.TextField("Object Name: ", me.name);
        }

        if (asset)
        {
            Debug.Log("I have a working assset here");
        }


        string message;

        message = EditorGUILayout.TextField("Description of the Object: ", asset.message);
        Debug.Log("m " + message + "a " + asset.message);

        //  this.Repaint();

        // itemName = EditorGUILayout.TextField(itemName);

        /****
         * asset.message = EditorGUILayout.TextArea("Description of object when in the Inventory", asset.message);
         *
         *
         *
         *
         * Sprite image = me.GetComponent<SpriteRenderer>().sprite;
         * if (image != null)
         * {
         * asset.objectImage = image;
         * }
         * else
         * {
         * asset.objectImage = (Sprite)EditorGUILayout.ObjectField("Sprite:", image, typeof(Sprite), true);
         * }
         *
         *
         *
         * string lookMessage = EditorGUILayout.TextField("lookie");
         * me.GetComponent<Inv_Collectable>().lookMessage = lookMessage;
         *
         * //   me.GetComponent<Inv_Collectable>().touchMessage = EditorGUILayout.TextField("", lookMessage);
         *  //GUILayout.TextArea("", me.GetComponent<Inv_Collectable>().touchMessage);
         *
         ***/
        GUILayout.Label("Optional", EditorStyles.boldLabel);

        /***
         *
         * me.GetComponent<Inv_Collectable>().destroyOnCollect = EditorGUILayout.Toggle("Destroy On Collection", true);
         * if (!me.GetComponent<Inv_Collectable>().destroyOnCollect) {
         * me.GetComponent<Inv_Collectable>().spriteSwitch = (Sprite)EditorGUILayout.ObjectField("Sprite:", image, typeof(Sprite), true);
         * // me.GetComponent<Inv_Collectable>().afterCollectMessage = GUILayout.TextArea("", me.GetComponent<Inv_Collectable>().afterCollectMessage);
         * }
         *
         *
         ****/

        GUILayout.FlexibleSpace();



        Debug.Log("message above button: " + message + "a " + asset.message);


        if (GUILayout.Button("Button"))
        {
            //CreateObject(me, itemName);
            Debug.Log("DOWN BELOW " + message + " c");
            asset.message = message + "but this works? why is message empty";
            Debug.Log("message after:  " + message + "asset after:  " + asset.message);
            string path = "Assets/" + me.name + ".asset";
            AssetDatabase.CreateAsset(asset, path);
            AssetDatabase.SaveAssets();
            EditorUtility.FocusProjectWindow();
            Selection.activeObject = asset;

            this.Close();
        }
        if (GUI.changed)
        {
            EditorUtility.SetDirty(me);
        }
    }
Exemplo n.º 31
0
        public void HandleEquipItem(C_EquipItem equipPacket)
        {
            Item item = Inven.Get(equipPacket.ItemDbId);

            if (item == null)
            {
                return;
            }

            if (item.ItemType == ItemType.Consumable)
            {
                return;
            }

            // 착용 요청이라면, 겹치는 부위 해제
            if (equipPacket.Equipped)
            {
                Item unequipItem = null;

                if (item.ItemType == ItemType.Weapon)
                {
                    unequipItem = Inven.Find(i => i.Equipped && i.ItemType == ItemType.Weapon);
                }
                else if (item.ItemType == ItemType.Armor)
                {
                    ArmorType armorType = ((Armor)item).ArmorType;
                    unequipItem = Inven.Find(i => i.Equipped && i.ItemType == ItemType.Armor && ((Armor)i).ArmorType == armorType);
                }

                if (unequipItem != null)
                {
                    // 메모리 선적용
                    unequipItem.Equipped = false;

                    // DB Noti
                    DbTransaction.EquipItemNoti(this, unequipItem);

                    // 클라이언트 Noti
                    S_EquipItem equipOkItem = new S_EquipItem();
                    equipOkItem.ItemDbId = unequipItem.ItemDbId;
                    equipOkItem.Equipped = unequipItem.Equipped;
                    Session.Send(equipOkItem);
                }
            }

            {
                // 메모리 선적용
                item.Equipped = equipPacket.Equipped;

                // DB Noti
                DbTransaction.EquipItemNoti(this, item);

                // 클라이언트 Noti
                S_EquipItem equipOkItem = new S_EquipItem();
                equipOkItem.ItemDbId = equipPacket.ItemDbId;
                equipOkItem.Equipped = equipPacket.Equipped;
                Session.Send(equipOkItem);
            }

            RefreshAdditionalStat();
        }