Esempio n. 1
0
    public void  setPositionForGameOjectRPC(string playerName, string thingName, float x, float y, float z)
    {
        GameObject thePlayer = GameObject.Find(playerName);

        if (!thePlayer)
        {
            return;
        }

        equipPackage thePackage = thePlayer.GetComponent <equipPackage> ();

        if (!thePackage)
        {
            return;
        }

        equipBasics theThing = thePackage.allEquipsForSave.Find(s => s.equipName == thingName);

        if (!theThing)
        {
            return;
        }

        thePackage.allEquipsForSave.Remove(theThing);
        GameObject theOBJ = theThing.gameObject;

        theOBJ.SetActive(true);
        theOBJ.transform.position = new Vector3(x, y, z);
    }
Esempio n. 2
0
    //UI调用方法和回调方法=================================================================================================
    //将装备扔出出来给别人用
    //这个在网络游戏中应该是比较需要的
    public void dropTheEquip()
    {
        if (!theEquip && !equipSkillAdderNow)
        {
            systemValues.messageTitleBoxShow("尚未选定装备或者注灵材料");
            return;
        }

        equipBasics theEquipUse = theEquip != null ? theEquip : equipSkillAdderNow;
        string      nameUse     = theEquip != null ? theEquip.equipName : equipSkillAdderNow.equipExtraName;

        if (theEquipUse.isUsing)
        {
            thePackagePanelShow.wearEquip(theEquip);
        }

        Vector3 position = systemValues.thePlayer.transform.position + systemValues.thePlayer.transform.forward * 2.5f;

        systemValues.setPositionForGameOject(systemValues.thePlayer.gameObject.name, theEquipUse.equipName, position.x, position.y, position.z);

        //界面刷新
        equipSelectTypeButton.flashThePanel();
        thePackagePanelShow.makeFlash();
        equipInformationPanel.makeFlash();
        ShowMake();
        flashThePanel();
    }
Esempio n. 3
0
    //让某一个物体出现到指定位置
    public static void setPositionForGameOject(string playerName, string thingName, float x, float y, float z)
    {
        if (systemValues.theGameSystemMode == GameSystemMode.NET)
        {
            photonView.RPC("setPositionForGameOjectRPC", PhotonTargets.All, playerName, thingName, x, y, z);
        }
        else
        {
            GameObject thePlayer = GameObject.Find(playerName);
            if (!thePlayer)
            {
                return;
            }

            equipPackage thePackage = thePlayer.GetComponent <equipPackage> ();
            if (!thePackage)
            {
                return;
            }

            equipBasics theThing = thePackage.allEquipsForSave.Find(s => s.equipName == thingName);
            if (!theThing)
            {
                return;
            }

            thePackage.allEquipsForSave.Remove(theThing);
            GameObject theOBJ = theThing.gameObject;
            theOBJ.SetActive(true);
            theOBJ.transform.position = new Vector3(x, y, z);
        }
    }
Esempio n. 4
0
//	void OnCollisionEnter(Collision collisioner)
//	{
//		if (collisioner.gameObject.tag == "equip")
//		{
//			equipBasics theEquip = collisioner.gameObject.GetComponent <equipBasics> ();
//			if(allEquipsForSave.Contains(theEquip) == false)
//				allEquipsForSave.Add (theEquip);
//
//			collisioner.gameObject.SetActive(false);
//			systemValues.messageTitleBoxShow ("获得【"+theEquip.equipName+"】");
//			systemValues.thePlayer.theAudioPlayer.playClip (theGetEquipSoundClip);
//		}
//	}



    //工具方法

    private void quickSort(List <equipBasics> theP, int low, int high)
    {
        if (low >= high)
        {
            return;
        }

        int         first    = low;
        int         last     = high;
        equipBasics keySave  = theP [low];
        int         keyValue = theP[low].theSoulForThisEquip;

        while (low < high)
        {
            while (low < high && theP[high].theSoulForThisEquip >= keyValue)
            {
                high--;
            }
            theP[low] = theP[high];
            while (low < high && theP[low].theSoulForThisEquip <= keyValue)
            {
                low++;
            }
            theP[high] = theP[low];
        }
        theP[low] = keySave;
        quickSort(theP, first, low - 1);
        quickSort(theP, low + 1, last);
    }
Esempio n. 5
0
    void OnTriggerEnter(Collider collisioner)
    {
        if (collisioner.gameObject.tag.Equals("equip"))
        {
            equipBasics theEquip = collisioner.gameObject.GetComponent <equipBasics> ();
            if (allEquipsForSave.Contains(theEquip) == false)
            {
                allEquipsForSave.Add(theEquip);
            }

            collisioner.gameObject.SetActive(false);

            if (thePlayer == systemValues.thePlayer)
            {
                if (theEquip.theEquipType != equiptype.equipSkill)
                {
                    systemValues.messageTitleBoxShow("获得装备\n【" + theEquip.equipName + "】");
                }
                else
                {
                    //systemValues.messageTitleBoxShow ("获得图谱\n《"+systemValues.getEffectNameWithName( theEquip.equipName)+"》");
                    systemValues.messageTitleBoxShow("获得图谱\n《" + theEquip.equipExtraName + "》");
                }
                systemValues.thePlayer.theAudioPlayer.playClip(theGetEquipSoundClip);
            }
        }
    }
Esempio n. 6
0
    //真正获取装备的方法
    //用资源加载的方式来获得装备
    //也就是说,在游戏中看到的装备只是包含装备资源名字字符串的一个“别的东西”
    private void getEquipForPrivate(string theEquipName)
    {
        GameObject  theEquipObj = GameObject.Instantiate <GameObject>(Resources.Load <GameObject> ("Equips/" + theEquipName));
        equipBasics theEquip    = theEquipObj.GetComponent <equipBasics> ();

        allEquipsForSave.Add(theEquip);
        //至于 theEquipObj 想个办法看看怎么销毁或者显示一下
    }
Esempio n. 7
0
    public static int getSoulInForDestroyTheEquip(equipBasics theEquip)
    {
        int theSoulGet = (int)(theEquip.theSoulForThisEquip * 0.2f);

        theSoulGet += 8 * (theEquip.EquipLvNow - 1);
        theSoulGet += theEquip.theEffectNames.Count * 17;
        theSoulGet += 15;
        return(theSoulGet);
    }
Esempio n. 8
0
    void makeEquipShowingButton(equipShowingButton theButtonEQ, equipBasics theEquip)
    {
        //equipShowingButton theButtonEQ = theButton.GetComponent <equipShowingButton> ();
        theButtonEQ.makeStart();
        theButtonEQ.theEquip = theEquip;
        if (theButtonEQ is equipShopSelectButton)
        {
            (theButtonEQ as equipShopSelectButton).theValueText.text = theEquip.theSoulForThisEquip.ToString();
        }

        theButtonEQ.theEquipImage.sprite = systemValues.makeLoadSprite("equipPicture/" + theEquip.theEquipType + "/" + theEquip.equipPictureName);
    }
Esempio n. 9
0
    static string getTextForTrast(equipBasics theEquip, equipPackage theEquipPackage)
    {
        switch (theEquip.theEquipType)
        {
        case equiptype.body:
            return(equipBasics.equipTrast(theEquip, theEquipPackage.thEquipForBodyUsed));

            break;

        case equiptype.head:
            return(equipBasics.equipTrast(theEquip, theEquipPackage.thEquipForHeadUsed));

            break;

        case equiptype.weapon:
            return(equipBasics.equipTrast(theEquip, theEquipPackage.thEquipForWeaponUsed));

            break;

        case equiptype.shoe:
            return(equipBasics.equipTrast(theEquip, theEquipPackage.thEquipForShoeUsed));

            break;

        case equiptype.extra:
        {
            if (theEquipPackage.thEquipForExtraUsed1 != null)
            {
                //第一件饰品已经有了空缺就直接用
                return(equipBasics.equipTrast(theEquip, theEquipPackage.thEquipForExtraUsed1));
            }
            //两个饰品都装备了就跟第一个做对比
            else
            {
                return(equipBasics.equipTrast(theEquip, theEquipPackage.thEquipForExtraUsed2));
            }
        }
        break;

        case equiptype.god:
            return(equipBasics.equipTrast(theEquip, theEquipPackage.thEquipForGod));

            break;

        case equiptype.equipSkill:
            return("注灵效果各异,或许不应该只靠数值进行比较");

            break;
        }
        return("无法比较");
    }
Esempio n. 10
0
    //升级这个装备需要的灵力数量
    public static int getSoulCountForEquipLvUp(equipBasics theEquip, bool withLv1 = false)
    {
        int theSoulGet = 0;

        if (withLv1)
        {
            theSoulGet += 8 * (theEquip.EquipLvNow - 1);
        }
        else
        {
            theSoulGet += 8 * (theEquip.EquipLvNow);
        }
        return(theSoulGet);
    }
Esempio n. 11
0
    public static void makeTrast(equipBasics theEquip)
    {
        if (!theShowText)
        {
            print("no text");
            return;
        }

        if (!systemValues.thePlayer)
        {
            print("no player");
            return;
        }
        equipPackage thePackage = systemValues.thePlayer.GetComponentInChildren <equipPackage> ();

        if (!thePackage)
        {
            print("no package");
            return;
        }
        theShowText.text = getTextForTrast(theEquip, thePackage);
    }
Esempio n. 12
0
 public static void getEquipForOperate(equipBasics theEquipIn)
 {
     theEquip = theEquipIn;
     ShowMake();
 }
Esempio n. 13
0
 //展示这个注灵的效果
 public static void showEquipSkillAdderGet(equipBasics theEquip)
 {
     equipSkillAdderNow = theEquip;
     equipSkillAddInformationStatic.text  = systemValues.getEffectInfromationWithName(theEquip.equipName);
     equipSkillAddInformationStatic.text += "\n【潜力要求:" + theEquip.skillValueCountAll + "】";
 }
Esempio n. 14
0
 public static void changeEquipToIntroduct(equipBasics theEquipIn)
 {
     theEquipStatic = theEquipIn;
     //print ("name = "+ theEquipStatic.equipName);
     showEquipInformation();
 }
Esempio n. 15
0
 public static void setNewEquip(equipBasics theEquipIn)
 {
     theEquip = theEquipIn;
     makeTrast();
 }
Esempio n. 16
0
    public static void wearEquip(equipBasics theEquip)
    {
        string oldEquipName = "";

        //这是一件已经装备上的装备,所以需要卸下
        if (theEquip.isUsing)
        {
            //theTextForStatic.text = equipBasics.equipTrast (theEquip , null);//样例方法调用
            switch (theEquip.theEquipType)
            {
            case equiptype.body:
                theEquipPackage.thEquipForBodyUsed = null;
                break;

            case equiptype.head:
                theEquipPackage.thEquipForHeadUsed = null;
                break;

            case equiptype.weapon:
                theEquipPackage.thEquipForWeaponUsed = null;
                break;

            case equiptype.shoe:
                theEquipPackage.thEquipForShoeUsed = null;
                break;

            case equiptype.extra:
            {
                if (theEquipPackage.thEquipForExtraUsed1 == theEquip)
                {
                    theEquipPackage.thEquipForExtraUsed1 = null;
                }
                else
                {
                    theEquipPackage.thEquipForExtraUsed2 = null;
                }
            }
            break;

            case equiptype.god:
                theEquipPackage.thEquipForGod = null;
                break;
            }
            theEquip.DropThisThing(systemValues.thePlayer);
        }
        //替换当前的装备
        else
        {
            //theTextForStatic.text = equipBasics.equipTrast (theEquip , null);//样例方法调用
            switch (theEquip.theEquipType)
            {
            case equiptype.body:
            {
                if (theEquipPackage.thEquipForBodyUsed != null)
                {
                    oldEquipName = theEquipPackage.thEquipForBodyUsed.equipName;
                    theEquipPackage.thEquipForBodyUsed.DropThisThing(systemValues.thePlayer);
                }
                theEquipPackage.thEquipForBodyUsed = theEquip;
                theEquip.GetThisThing(systemValues.thePlayer);
            }
            break;

            case equiptype.head:
            {
                if (theEquipPackage.thEquipForHeadUsed != null)
                {
                    oldEquipName = theEquipPackage.thEquipForHeadUsed.equipName;
                    theEquipPackage.thEquipForHeadUsed.DropThisThing(systemValues.thePlayer);
                }
                theEquipPackage.thEquipForHeadUsed = theEquip;
                theEquip.GetThisThing(systemValues.thePlayer);
            }
            break;

            case equiptype.weapon:
            {
                if (theEquipPackage.thEquipForWeaponUsed != null)
                {
                    oldEquipName = theEquipPackage.thEquipForWeaponUsed.equipName;
                    theEquipPackage.thEquipForWeaponUsed.DropThisThing(systemValues.thePlayer);
                }
                theEquipPackage.thEquipForWeaponUsed = theEquip;
                theEquip.GetThisThing(systemValues.thePlayer);
            }
            break;

            case equiptype.shoe:
            {
                if (theEquipPackage.thEquipForShoeUsed != null)
                {
                    oldEquipName = theEquipPackage.thEquipForShoeUsed.equipName;
                    theEquipPackage.thEquipForShoeUsed.DropThisThing(systemValues.thePlayer);
                }
                theEquipPackage.thEquipForShoeUsed = theEquip;
                theEquip.GetThisThing(systemValues.thePlayer);
            }
            break;

            case equiptype.extra:
            {
                if (theEquipPackage.thEquipForExtraUsed1 == null)
                {
                    theEquipPackage.thEquipForExtraUsed1 = theEquip;
                    theEquip.GetThisThing(systemValues.thePlayer);
                }
                else if (theEquipPackage.thEquipForExtraUsed2 == null)
                {
                    theEquipPackage.thEquipForExtraUsed2 = theEquip;
                    theEquip.GetThisThing(systemValues.thePlayer);
                }
                else
                {
                    oldEquipName = theEquipPackage.thEquipForExtraUsed1.equipName;
                    theEquipPackage.thEquipForExtraUsed1.DropThisThing(systemValues.thePlayer);
                    theEquipPackage.thEquipForExtraUsed1 = theEquip;
                    theEquip.GetThisThing(systemValues.thePlayer);
                }
            }
            break;

            case equiptype.god:
            {
                if (theEquipPackage.thEquipForGod != null)
                {
                    oldEquipName = theEquipPackage.thEquipForGod.equipName;
                    theEquipPackage.thEquipForGod.DropThisThing(systemValues.thePlayer);
                }
                theEquipPackage.thEquipForGod = theEquip;
                theEquip.GetThisThing(systemValues.thePlayer);
            }
            break;
            }
        }
        makeFlash();

//		if(string.IsNullOrEmpty(oldEquipName))
//			systemValues.messageBoxShow ("装备装载" ,theEquip.equipName+"已经投入使用" );
//		else
//			systemValues.messageBoxShow ("装备替换" ,"["+oldEquipName+"]替换为["+theEquip.equipName+ "]");
    }