コード例 #1
0
ファイル: StageView.cs プロジェクト: sooncat/ProjectRougeLike
    void OnCreateHeroStartNode(object p1, object p2)
    {
        CatDebug.LogFunc();

        HeroData heroData     = (HeroData)p1;
        int      targetNodeId = (int)p2;

        if (_heroSelectNodes.ContainsKey(heroData.Id))
        {
            Dragable d = _heroSelectNodes[heroData.Id].GetComponentInChildren <Dragable>();
            d.SetEnable(false);
        }

        GameObject go = InsHeroNode(heroData, false);//这里的英雄还可能与其他英雄交换,故不添加特殊dragicon

        go.transform.SetParent(_stageNodeRootTrans);
        //go.GetComponent<Button>().onClick.AddListener(() => { });

        Dropable drop = go.AddComponent <Dropable>();

        drop.ActionId = heroData.Id;
        drop.OnDroped = DropOnHero;

        Transform target     = _nodeUIs[targetNodeId];
        UINode    targetNode = target.GetComponent <UINode>();

        go.transform.SetParent(targetNode.GetRef("HeroRoot"));

        _fightHeroNodes.Add(heroData.Id, go.transform);
    }
コード例 #2
0
    public void EnableI(int DZIndex)
    {
        HandleTextFile.WriteLog("UI Log: Enable Players" + (DZIndex + 1) + " Dropzone", GameControler.SName);
        Dropable temp = (Dropable)dzones[DZIndex].GetComponent <Dropable>();

        temp.enabled = true;
    }
コード例 #3
0
ファイル: StageView.cs プロジェクト: sooncat/ProjectRougeLike
    void OnFightStateMapping(object p1, object p2)
    {
        CatDebug.LogFunc();

        Transform hsl = _stageNode.GetRef("HeroSelectList");

        hsl.gameObject.SetActive(false);

        Transform readyBtn = _stageNode.GetRef("ButtonReady");

        readyBtn.gameObject.SetActive(false);

        foreach (KeyValuePair <int, Transform> pair in _nodeUIs)
        {
            Dropable dropable = pair.Value.GetComponentInChildren <Dropable>();
            dropable.enabled = true;
        }

        Dictionary <int, FightHero> heroes = (Dictionary <int, FightHero>)p1;

        foreach (KeyValuePair <int, Transform> pair in _fightHeroNodes)
        {
            Dragable dragable = pair.Value.GetComponentInChildren <Dragable>();
            HeroData hd       = (HeroData)heroes[pair.Key].CreatureData;
            dragable.DragIcon = GameResSys.Instance.GetItem(hd.FightIcon);
        }

        //create hero show list
        CreateHeroShowList(heroes);
    }
コード例 #4
0
    // variable
    //private float _deathElapse = 0.0f;

    // Use this for initialization
    void Start()
    {
        BushState       = BushState.stat;
        BushAnim        = this.GetComponentInChildren <BushAnim>();
        m_BoxCollider2D = GetComponent <BoxCollider2D>();
        m_Dropable      = GetComponent <Dropable>();
    }
コード例 #5
0
                    public void Dropable()
                    {
                              this.driver = new ChromeDriver();
                              var dropablePage = new Dropable(this.driver);
                              dropablePage.DragAndDrop();
                              dropablePage.AssertTargetAtribut("ui-widget-header ui-droppable ui-state-highlight");

                    }
コード例 #6
0
 public void DisableAllDropZones()
 {
     HandleTextFile.WriteLog("UI Log: Disable All Dropzones", GameControler.SName);
     for (int i = 0; i < dzones.Count; i++)
     {
         Dropable temp = (Dropable)dzones[i].GetComponent <Dropable>();
         temp.enabled = false;
     }
 }
コード例 #7
0
 void Start()
 {
     _canvasGroup = GetComponent <CanvasGroup>();
     Parent       = transform.parent.GetComponent <Dropable>();
     if (Parent != null)
     {
         Parent.Child = this;                    //親子関係結びつけ
     }
 }
コード例 #8
0
ファイル: FightView.cs プロジェクト: sooncat/ProjectRougeLike
    void OnCreateFightView(object p1, object p2)
    {
        //create enemy
        List <Enemy> enemies = (List <Enemy>)p2;

        foreach (Enemy e in enemies)
        {
            Image cg = _enemyNode.GetRef("Cg").GetComponent <Image>();
            cg.sprite = GameResSys.Instance.GetCG(e.CreatureData.Cg);
            Slider s = _enemyNode.GetRef("HpSlider").GetComponent <Slider>();
            s.value = e.CreatureData.HpPercent;

            Dropable dropable = cg.gameObject.GetComponent <Dropable>();
            if (dropable == null)
            {
                dropable = cg.gameObject.AddComponent <Dropable>();
            }
            dropable.ActionId = e.InstanceId;
            dropable.OnDroped = OnDropOnEnemy;
        }

        //create heros
        Dictionary <int, FightHero> heros = (Dictionary <int, FightHero>)p1;

        _heroNodes = new Dictionary <int, Transform>();
        foreach (KeyValuePair <int, FightHero> pair in heros)
        {
            FightHero fh = pair.Value;

            GameObject go = Instantiate(_modelNode.GetNode("Hero").gameObject);
            go.transform.SetParent(_heroNodeRoot);

            UINode node = go.GetComponent <UINode>();
            SetHeroData(fh, node);
            node.GetRef("Hurt").gameObject.SetActive(false);
            node.GetRef("Supply").gameObject.SetActive(false);
            node.GetRef("MpSupply").gameObject.SetActive(false);
            node.GetRef("Selected").gameObject.SetActive(false);
            ShowHurt(node, -1);

            Dropable dropable = go.AddComponent <Dropable>();
            dropable.ActionId = fh.Id;
            dropable.OnDroped = OnDropOnHero;

            Button btn = node.GetRef("Icon").GetComponent <Image>().gameObject.AddComponent <Button>();
            btn.onClick.AddListener(() => { EventSys.Instance.AddEvent(InputEvent.FightSelectHero, fh.Id); });

            _heroNodes.Add(fh.Id, go.transform);
        }

        _rootNode.gameObject.SetActive(true);

        _winNode.gameObject.SetActive(false);
        _loseNode.gameObject.SetActive(false);
    }
コード例 #9
0
        public void MakeItemOnGround()
        {
            ItemData.ObjectHandle = NAPI.Object.CreateObject(
                Dropable.GetHashFromItem(ItemData.Type, ItemData.Value1),
                Position,
                new Vector3(0, 0, ItemData.RotZ),
                255,
                (uint)Dimension
                );

            SaveItem();
        }
コード例 #10
0
    GameObject returnItem(Dropable temp, int i)
    {
        GameObject drop = null;

        for (int e = temp.bottomChance; e <= temp.topChance; e++)
        {
            if (i == e)
            {
                return(temp.itemToDrop);
            }
        }
        return(drop);
    }
コード例 #11
0
ファイル: Dropper.cs プロジェクト: facybenbook/zelda-game-jam
    public void Drop(int itemPos)
    {
        GameObject g2 = new GameObject();

        g2.transform.position = MyFather.transform.position;
        Dropable   drop = drops[itemPos];
        GameObject g    = GameObject.Instantiate(drop.gameObject, g2.transform, false);

        g.GetComponent <Dropable>().SetItem(MyOwner);
        g.GetComponent <Dropable>().root           = g2;
        g.GetComponent <Transform>().localPosition = Vector3.zero;
        Debug.Log("Dropped: " + MyFather.name);
    }
コード例 #12
0
ファイル: Hooks.cs プロジェクト: rbfussell/Outward-Mods
        public static bool Prefix(Dropable __instance, ItemContainer _container)
        {
            if (_container)
            {
                int count = (bool)SharedCoopRewards.config.GetValue(Settings.Shared_World_Drops) ? Global.Lobby.PlayersInLobbyCount : 1;

                for (int i = 0; i < count; i++)
                {
                    GenerateContents(__instance, _container);
                }
            }

            return(false);
        }
コード例 #13
0
            public static bool Prefix(Dropable __instance, ItemContainer _container)
            {
                if (__instance.GetComponentInParent <Merchant>() || !_container)
                {
                    return(true);
                }

                // if (!Config.Extra_Loot)
                //     return;

                for (int i = 0; i < Global.Lobby.PlayersInLobbyCount; i++)
                {
                    __instance.ResetMainDrops(false);
                    __instance.GenerateContents(_container);
                }

                return(false);
            }
コード例 #14
0
ファイル: Enemy.cs プロジェクト: Macdup/LittleRedRidingHood
        virtual public void Start()
        {
            m_SpriteRenderer = this.GetComponent <SpriteRenderer> ();
            if (m_SpriteRenderer == null)
            {
                m_SpriteRenderer = this.GetComponentInChildren <SpriteRenderer> ();
            }
            m_Dropable = GetComponent <Dropable>();

            m_Animator = GetComponentInChildren <Animator>();
            if (m_Animator == null)
            {
                m_Animator = this.GetComponentInChildren <Animator> ();
            }
            m_Player             = GameObject.Find("Player").GetComponent <Player>();
            m_HitFeedbackManager = GameObject.Find("HitFeedbackManager").GetComponent <HitFeedbackManager>();
            m_RigidBody          = transform.GetComponent <Rigidbody2D>();
        }
コード例 #15
0
        public static void GenerateContents(Dropable self, ItemContainer container)
        {
            var allGuaranteed  = At.GetField(self, "m_allGuaranteedDrops") as List <GuaranteedDrop>;
            var mainDropTables = At.GetField(self, "m_mainDropTables") as List <DropTable>;

            for (int i = 0; i < allGuaranteed.Count; i++)
            {
                if (allGuaranteed[i])
                {
                    allGuaranteed[i].GenerateDrop(container);
                }
            }
            for (int j = 0; j < mainDropTables.Count; j++)
            {
                if (mainDropTables[j])
                {
                    mainDropTables[j].GenerateDrop(container);
                }
            }
        }
コード例 #16
0
ファイル: StageView.cs プロジェクト: sooncat/ProjectRougeLike
    void CreateNode(BaseStageNode stageNode, float posX, float posY)
    {
        GameObject go     = Instantiate(_stageNodeModel);
        UINode     uiNode = go.GetComponent <UINode>();

        go.transform.SetParent(_stageNodeRootTrans);
        go.transform.localPosition = new Vector3(posX, posY, 0);

        Button btn = uiNode.GetRef("Button").GetComponent <Button>();

        btn.onClick.AddListener(() => { OnNodeClicked(stageNode.Id); });

        Image nodeImage = uiNode.GetRef("Button").GetComponent <Image>();

        if (stageNode.NodeType.Equals(typeof(StageNodeFight).Name))
        {
            nodeImage.sprite = GameResSys.Instance.GetCard(stageNode.Icon);
        }
        else
        {
            nodeImage.sprite = GameResSys.Instance.GetNodeSprite(stageNode.Icon);
        }

        Dropable drop = uiNode.GetRef("Button").gameObject.AddComponent <Dropable>();

        drop.ActionId = stageNode.Id;
        drop.OnDroped = DropOnNode;
        if (!stageNode.NodeType.Equals(typeof(StageNodeStart).Name))
        {
            drop.enabled = false;
        }

        uiNode.GetRef("All").gameObject.SetActive(false);

        _nodeUIs.Add(stageNode.Id, go.transform);
    }
コード例 #17
0
    // Add up all our dropables drop rate, get random num, loop through probabilties until we get higher than our random num, return obj
    public GameObject Drop(int dropLvl, Dropable[] guaranteed = null, int guaranteedNum = 0)
    {
        // If we have a dropTable
        if (dropTable != null && instantiables != null) {

            // If we have a gauranteed Num
            if (guaranteedNum > 0) {

            }

            // If we have guaranteed drops
            if (guaranteed != null) {

            }

            // TODO the max range should be the sum of all probabilities
            float hitNum = Random.Range(0.0f, maxHitVal);
            float runningNum = 0;

            // Loop through each item
            for (int i = 0; i < dropTable.Length; i++) {

                // Increment our probabilty
                runningNum += dropTable[i].baseProbability;

                if (hitNum < runningNum) {
                    //Found our drop, create it
                    GameObject dropItem = (GameObject)Instantiate (instantiables[i],transform.position,transform.rotation);
                    dropItem.GetComponent<Dropable>().dropPreperation();
                    return dropItem;
                }
            }

        }
        return null;
    }
コード例 #18
0
        public static DM_DropTable ParseDropable(Dropable dropable, Merchant merchant = null, string containerName = "")
        {
            if (!dropable)
            {
                return(null);
            }

            var dropTableHolder = new DM_DropTable
            {
                Name = dropable.name
            };

            if (dropTableHolder.Name == "InventoryTable" && merchant)
            {
                dropTableHolder.Name = SceneManager.Instance.GetCurrentLocation(merchant.transform.position) + " - " + merchant.ShopName;
            }

            dropTableHolder.Name = dropTableHolder.Name.Trim();

            if (At.GetField(dropable, "m_allGuaranteedDrops") is List <GuaranteedDrop> guaranteedDrops)
            {
                foreach (GuaranteedDrop gDropper in guaranteedDrops)
                {
                    if (At.GetField(gDropper, "m_itemDrops") is List <BasicItemDrop> gItemDrops && gItemDrops.Count > 0)
                    {
                        foreach (BasicItemDrop gItemDrop in gItemDrops)
                        {
                            if (!gItemDrop.DroppedItem)
                            {
                                continue;
                            }

                            //var pos = dropable.transform.position;
                            AddGuaranteedDrop(dropTableHolder,
                                              gItemDrop.DroppedItem.ItemID,
                                              gItemDrop.DroppedItem.Name,
                                              gItemDrop.MinDropCount,
                                              gItemDrop.MaxDropCount);
                        }
                    }
                }
            }

            if (At.GetField(dropable, "m_conditionalGuaranteedDrops") is List <ConditionalGuaranteedDrop> conditionalGuaranteed)
            {
                foreach (var guaConditional in conditionalGuaranteed)
                {
                    if (!guaConditional.Dropper)
                    {
                        continue;
                    }

                    var drops = At.GetField(guaConditional.Dropper, "m_itemDrops") as List <BasicItemDrop>;
                    foreach (var gItemDrop in drops)
                    {
                        if (!gItemDrop.DroppedItem)
                        {
                            continue;
                        }

                        //var pos = dropable.transform.position;
                        AddGuaranteedDrop(dropTableHolder,
                                          gItemDrop.DroppedItem.ItemID,
                                          gItemDrop.DroppedItem.Name,
                                          gItemDrop.MinDropCount,
                                          gItemDrop.MaxDropCount);
                    }
                }
            }

            if (At.GetField(dropable, "m_mainDropTables") is List <DropTable> dropTables)
            {
                foreach (DropTable table in dropTables)
                {
                    if (ParseDropTable(dropTableHolder, containerName, dropable, table) is DropGeneratorHolder generatorHolder)
                    {
                        dropTableHolder.Random_Tables.Add(generatorHolder);
                    }
                }
            }

            if (At.GetField(dropable, "m_conditionalDropTables") is List <ConditionalDropTable> conditionals)
            {
                foreach (var conTable in conditionals)
                {
                    if (ParseDropTable(dropTableHolder, containerName, dropable, conTable.Dropper) is DropGeneratorHolder generatorHolder)
                    {
                        generatorHolder.DropConditionType = conTable.DropCondition.GetType().FullName;

                        dropTableHolder.Random_Tables.Add(generatorHolder);
                    }
                }
            }

            if (merchant == null)
            {
                string dir = Serializer.Folders.DropTables;
                if (!File.Exists(dir + "/" + dropTableHolder.Name + ".xml"))
                {
                    ListManager.DropTables.Add(dropTableHolder.Name, dropTableHolder);
                    Serializer.SaveToXml(dir, dropTableHolder.Name, dropTableHolder);
                }
            }

            return(dropTableHolder);
        }
コード例 #19
0
        public static DropGeneratorHolder ParseDropTable(DM_DropTable dropTableHolder, string containerName, Dropable dropper, DropTable table)
        {
            var generatorHolder = new DropGeneratorHolder
            {
                MinNumberOfDrops = table.MinNumberOfDrops,
                MaxNumberOfDrops = table.MaxNumberOfDrops,
                MaxDiceValue     = (int)At.GetField(table, "m_maxDiceValue"),
            };

            //if (generatorHolder.MaxDiceValue <= 0)
            //{
            //    SL.LogWarning("This random table's MaxDiceValue is 0, skipping...");
            //    return null;
            //}

            if (At.GetField(table, "m_dropAmount") is SimpleRandomChance dropAmount)
            {
                generatorHolder.ChanceReduction = dropAmount.ChanceReduction;
                generatorHolder.ChanceRegenQty  = dropAmount.ChanceRegenQty;

                if (dropAmount.CanRegen)
                {
                    generatorHolder.RegenTime = dropAmount.ChanceRegenDelay;
                }
                else
                {
                    generatorHolder.RegenTime = -1;
                }
            }
            else
            {
                generatorHolder.RegenTime = -1;
            }

            if (At.GetField(table, "m_emptyDropChance") is int i && generatorHolder.MaxDiceValue > 0)
            {
                try
                {
                    decimal emptyChance = (decimal)i / generatorHolder.MaxDiceValue;
                    generatorHolder.EmptyDrop = (float)emptyChance * 100;
                }
                catch
                {
                    generatorHolder.EmptyDrop = 0;
                }
            }

            if (At.GetField(table, "m_itemDrops") is List <ItemDropChance> itemDrops)
            {
                foreach (ItemDropChance drop in itemDrops)
                {
                    if (!drop.DroppedItem)
                    {
                        continue;
                    }

                    float percentage;
                    try
                    {
                        percentage = (float)((decimal)drop.DropChance / generatorHolder.MaxDiceValue) * 100f;
                    }
                    catch
                    {
                        percentage = 100f;
                    }

                    percentage = (float)Math.Round(percentage, 2);

                    string name = drop.DroppedItem.Name;

                    if (IsUnidentified(drop.DroppedItem.ItemID, out string identified))
                    {
                        name += " (" + identified + ")";
                    }

                    if (percentage >= 100)
                    {
                        AddGuaranteedDrop(dropTableHolder, drop.DroppedItem.ItemID, name, drop.MaxDropCount, drop.MinDropCount);
                    }
                    else
                    {
                        generatorHolder.Item_Drops.Add(new DropTableChanceEntry
                        {
                            Item_ID          = drop.DroppedItem.ItemID,
                            Item_Name        = name,
                            Min_Quantity     = drop.MinDropCount,
                            Max_Quantity     = drop.MaxDropCount,
                            Drop_Chance      = percentage,
                            Dice_Range       = drop.MaxDiceRollValue - drop.MinDiceRollValue,
                            ChanceReduction  = drop.ChanceReduction,
                            ChanceRegenDelay = drop.ChanceRegenDelay,
                            ChanceRegenQty   = drop.ChanceRegenQty
                        });
                    }
                }
            }

            return(generatorHolder);
        }
コード例 #20
0
 public void Drop(Dropable obj)
 {
     _ref = obj;
     OnDrop(this);
 }
コード例 #21
0
ファイル: Blockdata.cs プロジェクト: myung6024/The_Virus
    public void Recieve()
    {
        Transform[] childList = GetComponentsInChildren <Transform>(true);
        if (childList.Length > 1)
        {
            for (int i = 0; i < childList.Length; i++)
            {
                if (childList[i] != transform)
                {
                    Destroy(childList[i].gameObject);
                }
            }
            draw.Withdraw(int.Parse(Block_name));
        }

        Dropable Card  = GameObject.Find("Deck").GetComponent <Dropable>();
        Dropable Block = GameObject.Find("Deck").GetComponent <Dropable>();

        card_received = Card.card_to_block;//넘겨 줄때 카드 자체를 넘겨줌!!
        //Block_name = card_received.GetComponentInChildren<Transform>().Find("Image").GetComponent<Image>().sprite.name;



        //int인 체력 저항력 받아오는 부분
        CardStatus Card_int_info = card_received.GetComponent <CardStatus>();

        hp     = Card_int_info.GetHP();
        resist = Card_int_info.GetResistance();
        speed  = Card_int_info.GetSpeed();
        iType  = int.Parse(Card_int_info.GetName());
        //string인 카드 이름 받아오는 부분
        Block_name = Card_int_info.GetName();
        Debug.Log(hp);
        Debug.Log(resist);
        Debug.Log(Block_name);


        //Debug.Log(card_received.GetComponentInChildren<Transform>().Find("CardStrength").GetComponent<Text>().text);//카드를 보냈으니 체력을 받는지 확인!!
        //Block_name = Block.picture.name;
        //Debug.Log(Block_name);
        // MyBlockImg = GetComponent<SpriteRenderer>();
        // bMar = GameObject.Find("Blockmanager").GetComponent<Blockmanager>();

        Blockmanager temp = GameObject.Find("BlockManager").GetComponent <Blockmanager>();

        temp.CreateAdBlock(Block_name);

        /*
         * if (Block_name == "A")
         * {
         *  print("A");
         *  //Blockmanager.CreateAdBlock(Block_name);
         * }
         * if (Block_name == "B")
         * {
         *  //Blockmanager.CreateAdBlock(a);
         * }
         * if (Block_name == "C")
         * {
         *  print("e");
         * }
         * if (Block_name == "D")
         * {
         *  print("e");
         * }
         * if (Block_name == "E")
         * {
         *  print("e");
         * }*/
    }
コード例 #22
0
 public void Lift()
 {
     _ref = null;
     OnLift(this);
 }
コード例 #23
0
 private void Start()
 {
     currentArmor = defaultArmor;
     drop         = GetComponent <Dropable>();
 }
コード例 #24
0
    private void GetUIUnderMouse()
    {
        var pointer = new PointerEventData(EventSystem.current);

        pointer.position = Input.mousePosition;

        EventSystem.current.RaycastAll(pointer, UIhits);

        if (UIhits.Count < 1)
        {
            return;
        }

        GameObject clickedGO = null;

        foreach (RaycastResult r in UIhits)
        {
            if (!dragging)
            {
                if (r.gameObject.tag == "draggable_ui")
                {
                    clickedGO = r.gameObject;
                    //print (r.gameObject.name);
                    break;
                }
            }
            else
            {
                if (r.gameObject.tag == "dropable_ui")
                {
                    clickedGO = r.gameObject;
                    //print (r.gameObject.name);
                    break;
                }
            }
        }

        if (clickedGO != null)
        {
            if (!dragging)
            {
                draggable = clickedGO.GetComponent <Draggable> ();
                if (draggable != null)
                {
                    dragging = true;
                    draggable.OnBeginDrag();
                }
                else
                {
                    print(clickedGO.name + ": falta clase Draggable en gameobject");
                }
            }
            else
            {
                Dropable dropable = clickedGO.GetComponent <Dropable> ();
                if (dropable != null)
                {
                    dropable.OnDrop(draggable.gameObject);
                    draggable = null;
                }
                else
                {
                    print("falta clase Dropable en gameobject");
                }
            }
        }
        else
        {
            if (dragging)
            {
                draggable.OnDropingOut();
            }
        }
    }