예제 #1
0
    private void AddBuild(BuildInfo WareHouse)
    {
        //判断是否已有该类型的建筑
        foreach (CanvasItem item in m_lItems)
        {
            if (item != null)
            {
                // 已有
                if (item.Equalof(WareHouse) == true)
                {
                    item.SetCanvasItem(WareHouse);
                    item.ShowBearDestroy(true);
                    return;
                }
            }
        }
        ;
        //新的建筑
        GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.ListParent.transform);

        if (go)
        {
            CanvasItem item = go.GetComponent <CanvasItem>();
            if (item)
            {
                m_lItems.Add(item);
                item.SetCanvasItem(WareHouse);
                item.ShowBearDestroy(true);
            }
        }
    }
예제 #2
0
    public void SetData(SoldierInfo preInfo, SoldierInfo curInfo)
    {
        NGUIUtil.SetLableText <int>(MyHead.LblPreCombatPower, preInfo.m_combat_power);
        NGUIUtil.SetLableText <int>(MyHead.LblCurCombatPower, curInfo.m_combat_power);
        NGUIUtil.SetLableText <int>(MyHead.LblPreHp, preInfo.m_hp);
        NGUIUtil.SetLableText <int>(MyHead.LblCurHp, curInfo.m_hp);

        if (MyHead.AfterItem != null)
        {
            GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.AfterItem.transform);
            if (go)
            {
                CanvasItem item = go.GetComponent <CanvasItem>();
                if (item)
                {
                    item.SetCanvasItem(curInfo, 0, false);
                }
            }
        }
        if (MyHead.PreItem != null)
        {
            GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.PreItem.transform);
            if (go)
            {
                CanvasItem item = go.GetComponent <CanvasItem>();
                if (item)
                {
                    item.SetCanvasItem(preInfo, 0, false);
                }
            }
        }

        SetNewSkill(curInfo, preInfo);
    }
예제 #3
0
    private void CreateItem(SoldierInfo s)
    {
        GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.Parent);
        CanvasItem c  = go.GetComponent <CanvasItem>();

        if (c != null)
        {
            c.SetCanvasItem(s, 1);
        }
    }
예제 #4
0
    private void AddSoldier(SoldierInfo Soldier)
    {
        GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.ListParent.transform);

        if (go)
        {
            CanvasItem item = go.GetComponent <CanvasItem>();
            if (item)
            {
                m_lItems.Add(item);
                item.SetCanvasItem(Soldier);
                item.ShowBearDestroy(true);
            }
        }
    }
예제 #5
0
    private void AddBuild(BuildInfo WareHouse)
    {
        if (MyHead.ListParent == null || MyHead.CanvasItem == null)
        {
            NGUIUtil.DebugLog("ShipCanvasDialogWnd ListParent || CanvasItem is null!!!");
            return;
        }
        GameObject go   = NGUITools.AddChild(MyHead.ListParent, MyHead.CanvasItem);
        CanvasItem item = go.GetComponent <CanvasItem>();

        if (item)
        {
            item.SetCanvasItem(WareHouse);
        }
    }
예제 #6
0
    void SetUI()
    {
        NGUIUtil.SetLableText <string>(MyHead.Lbl01, (m_preInfo.m_strength_grow * 0.01).ToString());
        NGUIUtil.SetLableText <string>(MyHead.Lbl02, (m_curInfo.m_strength_grow * 0.01).ToString());

        NGUIUtil.SetLableText <string>(MyHead.Lbl03, (m_preInfo.m_intelligence_grow * 0.01).ToString());
        NGUIUtil.SetLableText <string>(MyHead.Lbl04, (m_curInfo.m_intelligence_grow * 0.01).ToString());

        NGUIUtil.SetLableText <string>(MyHead.Lbl05, (m_preInfo.m_agility_grow * 0.01).ToString());
        NGUIUtil.SetLableText <string>(MyHead.Lbl06, (m_curInfo.m_agility_grow * 0.01).ToString());

        if (MyHead.AfterItem != null)
        {
            GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.AfterItem.transform);
            if (go)
            {
                CanvasItem item = go.GetComponent <CanvasItem>();
                if (item)
                {
                    item.SetCanvasItem(m_curInfo, 0, false);
                }
            }
        }
        if (MyHead.PreItem != null)
        {
            GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.PreItem.transform);
            if (go)
            {
                CanvasItem item = go.GetComponent <CanvasItem>();
                if (item)
                {
                    item.SetCanvasItem(m_preInfo, 0, false);
                }
            }
        }

        float strAddNum = Mathf.Abs((m_curInfo.m_strength_grow - m_preInfo.m_strength_grow) * 0.01f);
        float intAddNum = Mathf.Abs((m_curInfo.m_intelligence_grow - m_preInfo.m_intelligence_grow) * 0.01f);
        float agiAddNum = Mathf.Abs((m_curInfo.m_agility_grow - m_preInfo.m_agility_grow) * 0.01f);

        MyHead.LblAdd1.text = "(" + NGUIUtil.GetStringByKey(88800047) + "+" + (strAddNum).ToString() + ")";
        MyHead.LblAdd2.text = "(" + NGUIUtil.GetStringByKey(88800049) + "+" + (intAddNum).ToString() + ")";
        MyHead.LblAdd3.text = "(" + NGUIUtil.GetStringByKey(88800048) + "+" + (agiAddNum).ToString() + ")";
    }
예제 #7
0
    /// <summary>
    /// 加载头像列表
    /// </summary>
    private void LoadHeadList(List <SoldierInfo> l, UITable Parent, int soldierType)
    {
        //异常判断
        if (Parent == null)
        {
            return;
        }
        //清空原有列表
        EmptyHeadList(Parent.gameObject, soldierType);

        if (l == null || l.Count == 0)
        {
            return;
        }
        foreach (SoldierInfo soldierInfo in l)
        {
            GameObject go = NDLoad.LoadWndItem("CanvasItem", Parent.transform);
            if (go != null)
            {
                CanvasItem item = go.GetComponent <CanvasItem>();
                if (item)
                {
                    m_CrewList.Add(soldierInfo.ID, item);
                    item.SetCanvasItem(soldierInfo, 3);
                    //item.ItemIndex = itemIndex++;
                    go.name = soldierInfo.m_name;
                    //NGUIUtil.SetItemPanelDepth(go, Parent.GetComponentInParent<UIPanel>());
                    if (IsContains(soldierInfo.ID))
                    {
                        item.SetMaskActive(true);
                    }
                }
            }
        }

        //RestoreGoCombatData();

        //排列,避免堆叠
        NGUIUtil.RepositionTable(Parent.gameObject);
    }
예제 #8
0
    private void SetUI()
    {
        MyHead.LblDefanNum.text      = m_oldBuildInfo.m_DefensePower.ToString();
        MyHead.LblAfterDefanNum.text = m_buildInfo.m_DefensePower.ToString();

        MyHead.LblHpNum.text      = m_oldBuildInfo.m_hp.ToString();
        MyHead.LblAfterHpNum.text = m_buildInfo.m_hp.ToString();

        if (MyHead.AfterItem != null)
        {
            GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.AfterItem.transform);
            if (go)
            {
                CanvasItem item = go.GetComponent <CanvasItem>();
                if (item)
                {
                    item.SetCanvasItem(m_buildInfo, false);
                    item.HiddenTrapNumLabel();
                }
            }
        }
        if (MyHead.PreItem != null)
        {
            GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.PreItem.transform);
            if (go)
            {
                CanvasItem item = go.GetComponent <CanvasItem>();
                if (item)
                {
                    item.SetCanvasItem(m_oldBuildInfo, false);
                    item.HiddenTrapNumLabel();
                }
            }
        }

        SetSkill();
    }
예제 #9
0
    /// <summary>
    /// 计算升星之后硬度增加.
    /// </summary>
    private void SetBuildProperty()
    {
        //硬度.
        float iSolidGrow     = 0;
        float iIntensityGrow = 0;
        float iTenacityGrow  = 0;

        buildingM.GetStarInfoGrow(m_backUpInfo, ref iSolidGrow, ref iIntensityGrow, ref iTenacityGrow);
        MyHead.LblSolidNum.text  = iSolidGrow.ToString("0.00");
        MyHead.LblTenaNum.text   = iTenacityGrow.ToString("0.00");
        MyHead.LblStrengNum.text = iIntensityGrow.ToString("0.00");

        if (MyHead.AfterItem != null)
        {
            GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.AfterItem.transform);
            if (go)
            {
                CanvasItem item = go.GetComponent <CanvasItem>();
                if (item)
                {
                    item.SetCanvasItem(m_build, false);
                    item.HiddenTrapNumLabel();
                }
            }
        }
        if (MyHead.PreItem != null)
        {
            GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.PreItem.transform);
            if (go)
            {
                CanvasItem item = go.GetComponent <CanvasItem>();
                if (item)
                {
                    item.SetCanvasItem(m_backUpInfo, false);
                    item.HiddenTrapNumLabel();
                }
            }
        }

        float iAfterSolidGrow     = 0;
        float iAfterIntensityGrow = 0;
        float iAfterTenacityGrow  = 0;

        buildingM.GetStarInfoGrow(m_build, ref iAfterSolidGrow, ref iAfterIntensityGrow, ref iAfterTenacityGrow);
        MyHead.LblSolidAfterNum.text  = iAfterSolidGrow.ToString("0.00");
        MyHead.LblTenaAfterNum.text   = iAfterTenacityGrow.ToString("0.00");
        MyHead.LblStrengAfterNum.text = iAfterIntensityGrow.ToString("0.00");

        int oriStar = buildingM.GetMinBuildStar(m_build.BuildType);

        BuildInfo oriInfo = new BuildInfo();

        oriInfo.BuildType = m_build.BuildType;
        oriInfo.StarLevel = oriStar;

        float oriSolidGrow     = 0;
        float oriIntensityGrow = 0;
        float oriTenacityGrow  = 0;

        buildingM.GetStarInfoGrow(oriInfo, ref oriSolidGrow, ref oriIntensityGrow, ref oriTenacityGrow);

        float iSolidAddNum = (iAfterSolidGrow - oriSolidGrow) + (iAfterSolidGrow - iSolidGrow) * (m_build.Level - 1);

        float iSTenaAddNum = (iAfterTenacityGrow - oriTenacityGrow) + (iAfterTenacityGrow - iTenacityGrow) * (m_build.Level - 1);

        float iStrengAddNum = (iAfterIntensityGrow - oriIntensityGrow) + (iAfterIntensityGrow - iIntensityGrow) * (m_build.Level - 1);

        MyHead.LblSolidAfterAddNum.text  = "(" + NGUIUtil.GetStringByKey(10000077) + "+" + iSolidAddNum.ToString("0.00") + ")";
        MyHead.LblTenaAfterAddNum.text   = "(" + NGUIUtil.GetStringByKey(10000079) + "+" + iSTenaAddNum.ToString("0.00") + ")";
        MyHead.LblStrengAfterAddNum.text = "(" + NGUIUtil.GetStringByKey(10000078) + "+" + iStrengAddNum.ToString("0.00") + ")";
    }
예제 #10
0
    public void SelectSoldier(int id)
    {
        CanvasItem item = null;

        m_CrewList.TryGetValue(id, out item);

        CanvasItem selecteditem = null;

        if (TryGetSelectedSoldier(id, ref selecteditem))
        {
            if (item == null)
            {
                //NGUIUtil.DebugLog("item=null " + selecteditem.gameObject.name);
                selecteditem.GetComponent <Collider>().enabled = false;
                selecteditem.transform.DOMove(Vector3.zero, 0.3f);
            }
            else
            {
                selecteditem.GetComponent <Collider>().enabled = false;
                item.GetComponent <Collider>().enabled         = false;
                //NGUIUtil.DebugLog(selecteditem.gameObject.name);
                selecteditem.transform.DOMove(item.transform.position, 0.3f);
            }


            SetCombatForece(id, false);
            m_SelectedSoldier.Remove(selecteditem);
            m_SelectedSoldierIDs.Remove(selecteditem.Soldier.ID);
            Reposition();
        }
        else if (m_SelectedSoldier.Count >= maxSelect)
        {
            item.m_bSelect = false;

            string showText = string.Format(NGUIUtil.GetStringByKey(10000157), maxSelect);
            NGUIUtil.ShowFreeSizeTipWnd(showText);
            return;
        }
        else if (m_SelectedSoldier.Count < maxSelect)
        {
            Transform  parent = MyHead.SelectedPos[m_SelectedSoldier.Count];
            GameObject go     = NDLoad.LoadWndItem("CanvasItem", MyHead.TSelected);
            if (go != null)
            {
                SetCombatForece(id, true);
                item.SetMaskActive(true);
                go.transform.position = item.transform.position;
                selecteditem          = go.GetComponent <CanvasItem>();
                if (selecteditem)
                {
                    selecteditem.SetCanvasItem(item.Soldier, 3);
                    //item.ItemIndex = itemIndex++;
                    go.name = item.Soldier.m_name;
                    //NGUIUtil.SetItemPanelDepth(go,MyHead.TSelected.GetComponentInParent<UIPanel>());
                    m_SelectedSoldier.Add(selecteditem);
                    m_SelectedSoldierIDs.Add(selecteditem.Soldier.ID);
                }
                Vector3 toPos = parent.position;

                item.GetComponent <Collider>().enabled = false;
                go.transform.DOMove(toPos, 0.1f);
            }
        }
        else
        {
        }
    }