예제 #1
0
 public void Init(List <Skill> SkillList)
 {
     SkillProbability.Adjust();
     SkillProbability.Init(6, false);
     foreach (var Skill in SkillList)
     {
         var SkillItem = new SkillItem()
         {
             Height = 100, Width = 80
         };
         SkillItem.Init(Skill);
         SkillItem.SelectSyncAction = O =>
         {
             SelectedSkill = O;
             foreach (var P in SkillPanel.Children.OfType <SkillItem>())
             {
                 if (!object.ReferenceEquals(P.Skill, O))
                 {
                     P.Unselect();
                 }
             }
             SelectSkill();
         };
         SkillPanel.Children.Add(SkillItem);
     }
 }
예제 #2
0
    public void ReleaseSkill(SkillBase skill, GameObject owner, GameObject target)
    {
        GameObject skillGo   = ObjectManager.Instance.InstantiateObject(skill.Path);
        SkillItem  skillItem = skillGo.GetComponent <SkillItem>();

        skillItem.Init(skill, owner, target);
        skillItem.ReleaseSkill();
    }
예제 #3
0
 public void SwitchTabInit()
 {
     if (isChanging)
     {
         return;
     }
     BackToTop();
     view.TopSkills.Clear();
     foreach (Transform child in view.SkillPanels[model.nowTab])
     {
         SkillItem si = child.GetComponent <SkillItem> ();
         si.Init(this);
         view.TopSkills.Add(si);
     }
     //全部xianshi
     view.BackToTopLevel.gameObject.SetActive(false);
     UnLockScroll();
     isSubLevel = false;
 }
예제 #4
0
    public void Init(FSClient client)
    {
        var map       = client.GetManager <RandomMapCreator>();
        var playerPos = Fixed2.zero;

        if (map)
        {
            playerPos = map.GetRandomPos();
        }
        else
        {
            playerPos = new Fixed2(client.random.Range(0, 20), client.random.Range(0, 20));
        }

        int count = GameUser.user.fightRoom.playerInfos.Count;

        for (int i = 0; i < count; i++)
        {
            var player = new PlayerData();
            player.Init(client, i);

            if (map != null)
            {
                player.transform.Position = playerPos + Fixed2.left * i.ToFixed();
            }
            else
            {
                player.transform.Position = new IDG.Fixed2(0, i);
            }

            client.objectManager.Instantiate(player);
        }

        for (int i = 0; i < m_nItemCount; i++)
        {
            ItemData item;
            if (i % 2 == 0)
            {
                var Titem = new SkillItem();
                item = Titem;
                Titem.Init(client);
                if (client.random.Range(0, 100) < 50)
                {
                    Titem.skillId = SkillId.拳击右直;
                }
                else
                {
                    Titem.skillId = SkillId.拳击左直;
                }
            }
            else
            {
                var Titem = new WeaponItem();
                item = Titem;
                Titem.Init(client);
                Titem.weaponId = WeaponId.F57;
            }

            if (map)
            {
                item.transform.Position = map.GetRandomPos();
            }
            else
            {
                item.transform.Position = new Fixed2(client.random.Range(0, 20), client.random.Range(0, 20));
            }
            client.objectManager.Instantiate(item);
        }

        for (int i = 0; i < enemy; i++)
        {
            var item = new ZombieData();
            item.Init(client);
            if (map)
            {
                item.transform.Position = map.GetRandomPos();
            }
            else
            {
                item.transform.Position = new Fixed2(client.random.Range(0, 20), client.random.Range(0, 20));
            }
            client.objectManager.Instantiate(item);
        }
    }