예제 #1
0
                } // end Freshen

                private void ReloadWeapon(IEquipInfo info)
                {
                    string id;

                    if (null == info)
                    {
                        id = GameManager.playerInfo.roletype + "_weapon";
                    }
                    else
                    {
                        id = info.id;
                    }
                    // end if
                    GameObject Go = ObjectTool.InstantiateGo(id, ResourcesTool.LoadPrefab(id));

                    if (null == Go)
                    {
                        DebugTool.LogError("ReloadWeapon ID: " + id + " prefab is don't exsit!");
                        return;
                    } // end if
                    if (null != weaponGo)
                    {
                        UnityEngine.Object.Destroy(weaponGo);
                    }
                    // end if
                    weaponGo = Go;
                    FurlWeapon();
                } // end ReloadWeapon
예제 #2
0
                } // end CreateInstance

                private MagicianCharacter(string name, Vector3 pos) : base(ConstConfig.MAGICIAN, ConstConfig.MAGICIAN,
                    ObjectTool.InstantiateGo(name, ResourcesTool.LoadPrefab(ConstConfig.MAGICIAN), null, pos, Vector3.zero, Vector3.one)) {
                    m_info = new MainCharacterInfo(name, ConstConfig.MAGICIAN, this);
                    m_avatar = new MagicianAvatar(gameObject.AddComponent<Animation>());
                    SkinnedMeshRenderer meshRenderer = transform.GetComponentInChildren<SkinnedMeshRenderer>();
                    Transform[] allChildren = transform.GetComponentsInChildren<Transform>();
                    Transform wingTrans = null;
                    Transform liftTrans = null;
                    Transform furlTrans = null;
                    foreach (Transform child in allChildren) {
                        if (child.gameObject.name == "wing_spine") {
                            wingTrans = child;
                            break;
                        } // end if
                    } // end foreach
                    foreach (Transform child in allChildren) {
                        if (child.gameObject.name == "right_hand") {
                            liftTrans = child;
                            break;
                        } // end if
                    } // end foreach
                    foreach (Transform child in allChildren) {
                        if (child.gameObject.name == "weapon_spine") {
                            furlTrans = child;
                            break;
                        } // end if
                    } // end foreach
                    m_mainSurface = new MainCharacterSurface(this, wingTrans, liftTrans, furlTrans, meshRenderer);
                    m_surface = m_mainSurface;
                    m_fsm = new MagicianFSM(this);
                    skill.PushSkill("500101");
                    skill.PushSkill("500102");
                    skill.PushSkill("500103");
                } // end MagicianCharacter
예제 #3
0
 public UIScrollItem(RectTransform parent, Vector3 localPos, Action<string> onClick) {
     gameObject = ObjectTool.InstantiateGo("ScrollItemUI", ResourcesTool.LoadPrefabUI("scroll_item_ui"), 
         parent, localPos, Vector3.zero, Vector3.one);
     gameObject.AddComponent<UIButton>().AddListener(delegate() { onClick(id); });
     infoText = transform.Find("Info").GetComponent<Text>();
     iconImage = transform.Find("Icon").GetComponent<Image>();
 } // end UIScrollItem
예제 #4
0
 private void updateName()
 {
     if (lab_Up_Name.InvokeRequired)
     {
         lab_Up_Name.Invoke(new Name_Update(updateName), new object[] { });
     }
     else if (lab_Right_Name.InvokeRequired)
     {
         lab_Right_Name.Invoke(new Name_Update(updateName), new object[] { });
     }
     else if (lab_Down_Name.InvokeRequired)
     {
         lab_Down_Name.Invoke(new Name_Update(updateName), new object[] { });
     }
     else if (lab_Left_Name.InvokeRequired)
     {
         lab_Left_Name.Invoke(new Name_Update(updateName), new object[] { });
     }
     else
     {
         lab_Up_Name.Text    = all.Name[place.getRealPlace_Up].ToString();
         lab_Right_Name.Text = all.Name[place.getRealPlace_Right].ToString();
         lab_Down_Name.Text  = all.Name[place.getRealPlace_Down].ToString();
         lab_Left_Name.Text  = all.Name[place.getRealPlace_Left].ToString();
         pic_Up.Image        = ResourcesTool.getImage(lab_Up_Name.Text);
         pic_Right.Image     = ResourcesTool.getImage(lab_Right_Name.Text);
         pic_Down.Image      = ResourcesTool.getImage(lab_Down_Name.Text);
         pic_Left.Image      = ResourcesTool.getImage(lab_Left_Name.Text);
     }
 }
예제 #5
0
            } // end Update

            public GameObject GetGameObject(string name) {
                if (string.IsNullOrEmpty(name)) {
#if __MY_DEBUG__
                    ConsoleTool.SetError(GetType() + "GetGameObject name is null or empty! Name:" + name);
#endif
                    return null;
                } // end if
                Stack<GameObject> objects;
                if (false == objectsMap.TryGetValue(name, out objects)) {
#if __MY_DEBUG__
                    Debug.Log(GetType() + "GetGameObject Name:" + name + " build a pool!");
#endif
                    objects = new Stack<GameObject>();
                    objectsMap[name] = objects;
                } // end if
                GameObject Go = objects.Count > 0 ? objects.Pop() : null;
                if (Go != null) return Go;
                // end if
                GameObject prefab = ResourcesTool.LoadPrefabPool(name);
                if (null == prefab) {
#if __MY_DEBUG__
                    ConsoleTool.SetError(GetType() + "GetGameObject prefab is null! name:" + name);
#endif
                    return null;
                } // end if
                Go = Object.Instantiate(prefab, poolParent);
                Go.name = name;
                return Go;
            } // end GetGameObject
예제 #6
0
                }     // end ReloadWeapon

                private void ReloadWing(IEquipInfo info)
                {
                    if (null == info)
                    {
                        if (null != wingGo)
                        {
                            Object.Destroy(wingGo);
                        }
                        return;
                    } // end if
                    string     id = info.id;
                    GameObject Go = ObjectTool.InstantiateGo(id, ResourcesTool.LoadPrefab(id));

                    if (null == Go)
                    {
                        DebugTool.LogError("ReloadWing ID: " + id + " prefab is don't exsit!");
                        return;
                    } // end if
                    if (null != wingGo)
                    {
                        Object.Destroy(wingGo);
                    }
                    // end if
                    wingGo = Go;
                    Go.transform.SetParent(wingTrans);
                    Go.transform.localScale    = Vector3.one;
                    Go.transform.localPosition = Vector3.zero;
                    Go.transform.localRotation = Quaternion.identity;
                    Transform[] allChildren = Go.transform.GetComponentsInChildren <Transform>();
                    foreach (Transform child in allChildren)
                    {
                        child.gameObject.layer = LayerConfig.IgnoreRaycast;
                    } // end foreach
                }     // end ReloadWing
예제 #7
0
                } // end ReloadEquip

                private void ReloadWeapon(IEquipInfo info)
                {
                    string id;

                    if (null == info)
                    {
                        id = roleType + "_weapon";
                    }
                    else
                    {
                        id = info.id;
                    }
                    // end if
                    GameObject Go = ObjectTool.InstantiateGo(id, ResourcesTool.LoadPrefab(id));

                    if (null == Go)
                    {
                        DebugTool.LogError("ReloadWeapon ID: " + id + " prefab is don't exsit!");
                        return;
                    } // end if
                    if (null != weaponGo)
                    {
                        Object.Destroy(weaponGo);
                    }
                    // end if
                    weaponGo = Go;
                    Go.transform.SetParent(liftTrans);
                    Go.transform.localScale    = Vector3.one;
                    Go.transform.localPosition = Vector3.zero;
                    Go.transform.localRotation = Quaternion.identity;
                    foreach (Transform child in Go.transform)
                    {
                        child.gameObject.layer = LayerConfig.IgnoreRaycast;
                    } // end foreach
                }     // end ReloadWeapon
예제 #8
0
                } // end Init

                private void InitAvatar(string roleType)
                {
                    string prefix = "";

                    switch (roleType)
                    {
                    case ConstConfig.SWORDMAN:
                        prefix = "swordman_";
                        break;

                    case ConstConfig.ARCHER:
                        prefix = "archer_";
                        break;

                    case ConstConfig.MAGICIAN:
                        prefix = "magician_";
                        break;

                    default:
                        DebugTool.LogError("DisplayRole roleType: " + roleType + "is not config!!");
                        return;
                    } // end switch
                    string[]  animPathArr = new string[] { "pose", "wait" };
                    Animation avatar      = displayGo.AddComponent <Animation>();

                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + animPathArr[0]), animPathArr[0]);
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + animPathArr[1]), animPathArr[1]);
                    foreach (AnimationState state in avatar)
                    {
                        state.speed = 0.5f;
                    } // end foreach
                    avatar.Play(animPathArr[0]);
                    avatar.PlayQueued(animPathArr[1], QueueMode.CompleteOthers);
                } // end InitAvatar
예제 #9
0
                public SwordmanAvatar(Animation avatar) : base(avatar)
                {
                    string prefix = "swordman_";

                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "idle"), "idle");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "walk"), "walk");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "wait"), "wait");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "run"), "run");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "pose"), "pose");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "hurt"), "hurt");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "die"), "die");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "skill1"), "skill1");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "skill2"), "skill2");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "skill3"), "skill3");
                    foreach (AnimationState state in avatar)
                    {
                        state.speed = 0.5f;
                    } // end foreach
                    for (int i = 1; i < 5; i++)
                    {
                        for (int j = 1; j < 4; j++)
                        {
                            string name = "attack" + i + "_" + j;
                            avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + name), name);
                        } // end for
                    }     // end for
                }         // end SwordsmanAvatar
예제 #10
0
                } // end OnClickExitBtn

                public void DoBeforeEntering() {
                    gameObject = ObjectTool.InstantiateGo("SettingPanelUI", ResourcesTool.LoadPrefabUI(id), 
                        SceneManager.mainCanvas.rectTransform);
                    rectTransform = gameObject.GetComponent<RectTransform>();
                    rectTransform.sizeDelta = SceneManager.mainCanvas.sizeDelta;
                    rectTransform.Find("ExitBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickExitBtn(); });
                    rectTransform.Find("CloseBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickCloseBtn(); }, "ui_close");
                    Slider musicSlider = rectTransform.Find("MusicSlider").GetComponent<Slider>();
                    musicSlider.minValue = 0f;
                    musicSlider.maxValue = 1f;
                    musicSlider.value = GameManager.gameSetting.musicValue;
                    musicSlider.onValueChanged.AddListener(delegate (float value) { OnMusicSliderChange(value); });
                    Slider soundSlider = rectTransform.Find("SoundSlider").GetComponent<Slider>();
                    soundSlider.minValue = 0f;
                    soundSlider.maxValue = 1f;
                    soundSlider.value = GameManager.gameSetting.soundValue;
                    soundSlider.onValueChanged.AddListener(delegate (float value) { OnSoundSliderChange(value); });
                    Toggle simple = rectTransform.Find("GameQuality/NormalToggle").GetComponent<Toggle>();
                    simple.onValueChanged.AddListener(delegate (bool isOn) { OnToggleNormal(isOn); });
                    Toggle good = rectTransform.Find("GameQuality/GoodToggle").GetComponent<Toggle>();
                    good.onValueChanged.AddListener(delegate (bool isOn) { OnToggleGood(isOn); });
                    if (GameManager.gameSetting.currentQuality == "Good") {
                        good.isOn = true;
                    } // end if
                } // end DoBeforeEntering
예제 #11
0
                public ArcherAvatar(Animation avatar) : base(avatar) {
                    string prefix = "archer_";
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "idle"), "idle");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "walk"), "walk");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "wait"), "wait");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "run"), "run");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "pose"), "pose");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "hurt"), "hurt");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "die"), "die");

                    foreach (AnimationState state in avatar) {
                        state.speed = 0.5f;
                    } // end foreach
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "skill1_1"), "skill1_1");
                    avatar["skill1_1"].speed = 0.2f;
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "skill1_2"), "skill1_2");
                    avatar["skill1_2"].speed = 0.2f;
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "attack"), "attack");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "attCrit"), "attCrit");

                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "skill2_1"), "skill2_1");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "skill2_2"), "skill2_2");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "skill2_3"), "skill2_3");

                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "skill3_1"), "skill3_1");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "skill3_2"), "skill3_2");
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + "skill3_3"), "skill3_3");
                } // end SwordsmanAvatar
예제 #12
0
                } // end OnClickInfoBtn

                public void DoBeforeEntering() {
                    gameObject = ObjectTool.InstantiateGo("PackPanelUI", ResourcesTool.LoadPrefabUI(id), SceneManager.mainCanvas.rectTransform);
                    rectTransform = gameObject.GetComponent<RectTransform>();
                    rectTransform.sizeDelta = SceneManager.mainCanvas.sizeDelta;
                    string prefix = "GridPanel/Grids/Grid_";
                    gridArray = new UIGrid[ConstConfig.GRID_COUNT];
                    infoText = rectTransform.Find("InfoText").GetComponent<Text>();
                    infoText.fontSize = 10;
                    infoText.alignByGeometry = false;
                    coinText = rectTransform.Find("Coin/Counter").GetComponent<Text>();
                    coinText.fontSize = 36;
                    coinText.text = SceneManager.mainCharacter.pack.coin.ToString();
                    LoseItem();
                    for (int i = 0; i < gridArray.Length; i++) {
                        int id = i;
                        gridArray[i] = rectTransform.Find(prefix + i).gameObject.AddComponent<UIGrid>();
                        gridArray[i].AddAction(delegate () { OnSelectedGrid(id); });
                        gridArray[i].AddAction(OnExchangeGrid);
                        gridArray[i].SetID(i);
                    } // end for
                    OnToggleEquipment(true);
                    rectTransform.Find("GridPanel/ToggleGroup/Equipment").GetComponent<Toggle>().onValueChanged.AddListener(OnToggleEquipment);
                    rectTransform.Find("GridPanel/ToggleGroup/Consumable").GetComponent<Toggle>().onValueChanged.AddListener(OnToggleConsumable);
                    rectTransform.Find("GridPanel/ToggleGroup/Stuff").GetComponent<Toggle>().onValueChanged.AddListener(OnToggleStuff);
                    rectTransform.Find("GridPanel/ToggleGroup/Blueprint").GetComponent<Toggle>().onValueChanged.AddListener(OnTogglePrint);
                    rectTransform.Find("ArrangeBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnArrangeBtn(); });
                    rectTransform.Find("UseBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickUseBtn(); });
                    rectTransform.Find("DiscardBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickDiscardBtn(); });
                    rectTransform.Find("CloseBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickCloseBtn(); }, "ui_close");
                } // end DoBeforeEntering
예제 #13
0
 public ItemUI(GameObject go)
 {
     uiTarget = GameObject.Instantiate(ResourcesTool.GetResoureGameObject(ResourcesTool.ResourceName.itemPrefab));
     uiTarget.transform.SetParent(go.transform);
     uiTarget.transform.localPosition = Vector3.zero;
     uiTarget.transform.localScale    = Vector3.one;
 }
예제 #14
0
                } // end DoBeforeEntering

                private void OnSelectedGrid(int id) {
                    string itemID = blueprintPack.GetItemIDForGrid(id);
                    IBluePrintInfo info = Configs.itemConfig.GetItemInfo(itemID) as IBluePrintInfo;
                    if (null == info) return;
                    // end if
                    printInfo = info;
                    buleprint.SetUIItem(ResourcesTool.LoadSprite(info.spritepath), 0);
                    int number = info.stuffNumber;
                    int x = (number - 1) * 40;
                    for (int i = 0; i < stuffArray.Length; i++) {
                        if (i < number) {
                            string stuffID = "";
                            if (false == info.TryGetStuffID(i, out stuffID)) continue;
                            // end if
                            IItemInfo stuff = Configs.itemConfig.GetItemInfo(stuffID);
                            if (null == stuff) continue;
                            // end if
                            int stuffCount = 0;
                            if (false == info.TryGetStuffCount(i, out stuffCount)) continue;
                            // end if
                            stuffArray[i].transform.localPosition = new Vector3((x - 80 * i), 0, 0);
                            stuffArray[i].gameObject.SetActive(true);
                            int numerator = SceneManager.mainCharacter.pack.GetItemPack(ConstConfig.STUFF).GetCountForID(stuff.id);
                            stuffArray[i].SetUIItem(ResourcesTool.LoadSprite(stuff.spritepath), 0);
                            stuffArray[i].item.SetPercent(numerator, stuffCount);
                            continue;
                        } // end if
                        stuffArray[i].gameObject.SetActive(false);
                    } // end for
                } // end OnSelectedGrid
예제 #15
0
            } // end PlaySoundOnceForPath

            public void PlaySoundCacheForPath(string name, string path)
            {
                if (string.IsNullOrEmpty(name))
                {
                    return;
                }
                // end if
                AudioClip clip;

                if (false == clipCache.TryGetValue(name, out clip))
                {
                    clip = ResourcesTool.LoadAudioClip(path);
                    if (null == clip)
                    {
                        return;
                    }
                    // end if
                    clipCache[name] = clip;
                } // end if
                if (null == clip)
                {
                    return;
                }
                // end if
                audio.PlayOneShot(clip, valume);
            } // end PlaySoundCacheForPath
예제 #16
0
                } // end UIFightPanel

                public void DoBeforeEntering() {
                    isShowBar = false;
                    gameObject = ObjectTool.InstantiateGo("UIFightPanel", ResourcesTool.LoadPrefabUI(id), 
                        SceneManager.mainCanvas.rectTransform);
                    rectTransform = gameObject.GetComponent<RectTransform>();
                    rectTransform.sizeDelta = SceneManager.mainCanvas.sizeDelta;
                    mainCharacterPanel = rectTransform.Find("MainCharacterInfoPanel").gameObject.AddComponent<UIMainCharacterInfoPanel>();
                    lockCharacterPanel = rectTransform.Find("LockCharacterInfoPanel").gameObject.AddComponent<UILockCharacterInfoPanel>();
                    lockCharacterPanel.gameObject.SetActive(false);
                    buffPanel = new UIBuffPanel(rectTransform.Find("BuffPanle") as RectTransform, new Vector2(35f, 35f));
                    avatar = rectTransform.Find("BarPanel").GetComponent<Animator>();
                    rectTransform.Find("BarPanel/BarBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickBarBtn(); });
                    rectTransform.Find("BarPanel/BtnList/InfoBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(OnClickInfoBtn);
                    rectTransform.Find("BarPanel/BtnList/PackBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(OnClickPackBtn);
                    rectTransform.Find("BarPanel/BtnList/SettingBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(OnClickSettingBtn);
                    rectTransform.Find("AttackBtn").gameObject.AddComponent<UIButton>().AddListener(OnClickAttackBtn);
                    skillPanel = new UISkillPanel(rectTransform);
                    GameObject joystickUI = ObjectTool.InstantiateGo("Joystick", ResourcesTool.LoadPrefabUI("joystick_ui"), rectTransform);
                    joystickUI.transform.Find("JoystickUI").gameObject.AddComponent<UIJoystick>();
                    joystickUI.GetComponent<RectTransform>().sizeDelta =  SceneManager.mainCanvas.sizeDelta;
                    if (null == SceneManager.mainCharacter) {
                        DebugTool.LogError(GetType() + "DoBeforeEntering SceneManager mainCharacter is null!");
                        return;
                    } // end if
                    string roleType = SceneManager.mainCharacter.info.characterData.roleType;
                    rectTransform.Find("AttackBtn").GetComponent<Image>().sprite = ResourcesTool.LoadSprite(roleType + "_attack");
                } // end DoBeforeEntering
예제 #17
0
                } // end OnClickInfoBtn

                public void DoBeforeEntering() {
                    gameObject = ObjectTool.InstantiateGo("InfoPanelUI", ResourcesTool.LoadPrefabUI(id), 
                        SceneManager.mainCanvas.rectTransform);
                    rectTransform = gameObject.GetComponent<RectTransform>();
                    rectTransform.sizeDelta = SceneManager.mainCanvas.sizeDelta;
                    selected = "";
                    infoText = rectTransform.Find("InfoText").GetComponent<Text>();
                    infoText.fontSize = 10;
                    display = rectTransform.Find("DisplayRaw").gameObject.AddComponent<UIDisplayRaw>();
                    display.SetDisplayGo(new DisplayRole(GameManager.playerInfo.roletype, SceneManager.mainCharacter.pack.GetWearInfo()));
                    cellDict = new Dictionary<string, UICell>();
                    for (int i = 0; i < ConstConfig.EquipTypeList.Length; i++) {
                        string type = ConstConfig.EquipTypeList[i];
                        cellDict[type] = rectTransform.Find("Cells/Cell_" + i).gameObject.AddComponent<UICell>();
                        cellDict[type].AddAction(delegate () { OnSelectedCell(type); });
                    } // end for
                    selector = rectTransform.Find("Selector").gameObject;
                    selector.SetActive(false);
                    infoPanel = rectTransform.Find("InfoPanel").gameObject;
                    cellText = infoPanel.transform.Find("InfoText").GetComponent<Text>();
                    cellText.fontSize = 10;
                    infoPanel.SetActive(false);
                    rectTransform.Find("TakeOffBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(OnClickTakeOffBtn);
                    rectTransform.Find("CloseBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickCloseBtn(); },  "ui_close");
                    UpdateShowInfo();
                } // end DoBeforeEntering
예제 #18
0
                } // end UISettingPanel

                public void DoBeforeEntering() {
                    stuffArray = new UICell[4];
                    cellArray = new UICell[ConstConfig.GRID_COUNT];
                    blueprintPack = SceneManager.mainCharacter.pack.GetItemPack(ConstConfig.PRINT);
                    gameObject = ObjectTool.InstantiateGo("ForgePanelUI", ResourcesTool.LoadPrefabUI(id), SceneManager.mainCanvas.rectTransform);
                    rectTransform = gameObject.GetComponent<RectTransform>();
                    rectTransform.sizeDelta = SceneManager.mainCanvas.sizeDelta;
                    buleprint = rectTransform.Find("Blueprint/Print").gameObject.AddComponent<UICell>();
                    for (int i = 0; i < cellArray.Length; i++) {
                        cellArray[i] = rectTransform.Find("GridPanel/Grids/Grid_" + i).gameObject.AddComponent<UICell>();
                        string itemID = blueprintPack.GetItemIDForGrid(i);
                        IItemInfo info = Configs.itemConfig.GetItemInfo(itemID);
                        if (null == info) {
                            cellArray[i].HideItem();
                            continue;
                        } // end 
                        int id = i;
                        cellArray[i].AddAction(delegate () { OnSelectedGrid(id); });
                        cellArray[i].SetUIItem(ResourcesTool.LoadSprite(info.spritepath), 0);
                    } // end for
                    for (int i = 0; i < stuffArray.Length; i++) {
                        stuffArray[i] = rectTransform.Find("Blueprint/Stuff_" + i).gameObject.AddComponent<UICell>();
                        stuffArray[i].gameObject.SetActive(false);
                    } // end for
                    rectTransform.Find("ForgeBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickForgeBtn(); });
                    rectTransform.Find("CloseBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickCloseBtn(); }, "ui_close");
                } // end DoBeforeEntering
예제 #19
0
                } // end ReloadWeapon

                private void ReloadWing(IEquipInfo info)
                {
                    if (null == info)
                    {
                        if (null != wingGo)
                        {
                            UnityEngine.Object.Destroy(wingGo);
                        }
                        // end if
                        return;
                    } // end if
                    string     id = info.id;
                    GameObject Go = ObjectTool.InstantiateGo(id, ResourcesTool.LoadPrefab(id));

                    if (null == Go)
                    {
                        DebugTool.LogError("ReloadWing ID: " + id + " prefab is don't exsit!");
                        return;
                    } // end if
                    if (null != wingGo)
                    {
                        UnityEngine.Object.Destroy(wingGo);
                    }
                    // end if
                    wingGo = Go;
                    wingGo.transform.SetParent(wingTrans);
                    wingGo.transform.localPosition = Vector3.zero;
                    wingGo.transform.localRotation = Quaternion.identity;
                } // end ReloadWing
예제 #20
0
            } // end NoviceVillage

            public void Initialize() {
                m_mainCanvas = new MainCanvas();
                m_mainAudio = new MainAudio();
                m_mainCamera = new MainCamera();
                ObjectTool.InstantiateGo("npc_transmitter", ResourcesTool.LoadPrefab("npc_transmitter"),
                    null, new UnityEngine.Vector3(0, 0, 10), new UnityEngine.Vector3(0, 270, 0), UnityEngine.Vector3.one).AddComponent<NPC_Transmitter2>();
                m_characterManager.factory.CreateMainCharacter(new UnityEngine.Vector3(0, 0, 0));
                m_characterManager.factory.CreateNPC("901001", new UnityEngine.Vector3(20, 0, 0));
                m_characterManager.factory.CreateNPC("902001", new UnityEngine.Vector3(20, 0, 10));
                m_characterManager.factory.CreateNPC("903001", new UnityEngine.Vector3(20, 0, 20));
                m_characterManager.factory.CreateNPC("904001", new UnityEngine.Vector3(10, 0, 20));
                m_characterManager.factory.CreateNPC("904002", new UnityEngine.Vector3(0, 0, 20));
                m_characterManager.factory.CreateNPC("904003", new UnityEngine.Vector3(-10, 0, 20));
                m_characterManager.factory.CreateNPC("904004", new UnityEngine.Vector3(-20, 0, 20));
                m_characterManager.factory.CreateNPC("904005", new UnityEngine.Vector3(-20, 0, 10));
                m_characterManager.factory.CreateNPC("904006", new UnityEngine.Vector3(-20, 0, 0));
                m_characterManager.factory.CreateNPC("904007", new UnityEngine.Vector3(-20, 0, -10));
                m_characterManager.factory.CreateNPC("904008", new UnityEngine.Vector3(-20, 0, -20));
                m_characterManager.factory.CreateNPC("904009", new UnityEngine.Vector3(-10, 0, -20));
                m_characterManager.factory.CreateNPC("904010", new UnityEngine.Vector3(0, 0, -20));
                m_characterManager.factory.CreateNPC("905001", new UnityEngine.Vector3(10, 0, -20));
                m_characterManager.factory.CreateNPC("905002", new UnityEngine.Vector3(20, 0, -20));
                m_characterManager.factory.CreateNPC("905003", new UnityEngine.Vector3(20, 0, -10));
                m_characterManager.factory.CreateNPC("906001", new UnityEngine.Vector3(30, 0, 0));
                m_characterManager.factory.CreateNPC("906002", new UnityEngine.Vector3(0, 0, 30));
                m_characterManager.factory.CreateNPC("906003", new UnityEngine.Vector3(-30, 0, 0));
                m_mainAudio.PlayBackgroundMusic("fight_scene_bgm");
                if (null == mainCharacter) {
                    DebugTool.LogError("NoviceVillage CreateMainCharacter is null!!");
                    return;
                } // end if
                m_mainCamera.SetTarget(mainCharacter);
                mainCharacter.fsm.PerformTransition("wait");
                uiPanelFSM.PerformTransition(new UIFightPanel());
            } // end Initialize
예제 #21
0
                } // end UISelectRolePanel

                public void DoBeforeEntering()
                {
                    gameObject = ObjectTool.InstantiateGo("SelectRolePanelUI", ResourcesTool.LoadPrefabUI(id),
                                                          SceneManager.mainCanvas.rectTransform);
                    rectTransform           = gameObject.GetComponent <RectTransform>();
                    rectTransform.sizeDelta = SceneManager.mainCanvas.sizeDelta;
                    roleindex       = 0;
                    createIndex     = -1;
                    selectedindex   = -1;
                    roleDict        = new Dictionary <int, string[]>();
                    t_roleName      = rectTransform.Find("RoleName").GetComponent <Text>();
                    t_roleName.text = "";
                    display         = rectTransform.Find("DisplayRaw").gameObject.AddComponent <UIDisplayRaw>();
                    string prefix = "RoleList/Role_";

                    for (int i = 0; i < 3; i++)
                    {
                        int index = i;
                        roleDict.Add(index, SqliteManager.GetRoleInfoWithID(GameManager.playerInfo.username, index));
                        rectTransform.Find(prefix + i).gameObject.AddComponent <UIButtonNormal>().AddListener(delegate() { OnSwitchRole(index); });
                        if (null != roleDict[index])
                        {
                            rectTransform.Find(prefix + i + "/Text").GetComponent <Text>().text = roleDict[index][0];
                        }
                        // end if
                    } // end for
                    rectTransform.Find("DeleteRoleBtn").gameObject.AddComponent <UIButtonNormal>().AddListener(OnClickDeleteRoleBtn);
                    rectTransform.Find("StartGameBtn").gameObject.AddComponent <UIButtonNormal>().AddListener(OnClickStartGameBtn);
                    InitialSwitchRole();
                } // end DoBeforeEntering
예제 #22
0
                } // end UIGroceryPanel

                public void DoBeforeEntering() {
                    gameObject = ObjectTool.InstantiateGo("GroceryPanelUI", ResourcesTool.LoadPrefabUI(id),
                        SceneManager.mainCanvas.rectTransform);
                    rectTransform = gameObject.GetComponent<RectTransform>();
                    rectTransform.sizeDelta = SceneManager.mainCanvas.sizeDelta;
                    new UIScrollView(gameObject.transform.Find("Scroll View").GetComponent<ScrollRect>());
                    rectTransform.Find("CloseBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickCloseBtn(); }, "ui_close");
                } // end DoBeforeEntering
예제 #23
0
        /// <summary>
        /// 播放打牌聲音
        /// </summary>
        internal void PlaySound(Brand brand)
        {
            SoundPlayer soundplayer = new SoundPlayer();

            soundplayer.Stream = ResourcesTool.getSound(brand);

            soundplayer.Play();
        }
예제 #24
0
 /// <summary>
 /// 初始化方法
 /// </summary>
 /// <param name="go"></param>
 public ItemUI(GameObject go, Item item, int amount = 1)
 {
     uiTarget = GameObject.Instantiate(ResourcesTool.GetResoureGameObject(ResourcesTool.ResourceName.itemPrefab));
     uiTarget.transform.SetParent(go.transform);
     uiTarget.transform.localPosition = Vector3.zero;
     uiTarget.transform.localScale    = Vector3.one;
     InitItem(item, amount);
     SetActive(true);
 }
예제 #25
0
                public void SetID(int id) { this.id = id; } // end SetID

                public void SetUIItem(Sprite sprite, int count) {
                    if (null == item) {
                        item = ObjectTool.InstantiateGo("ItemUI", ResourcesTool.LoadPrefabUI("item_ui"), transform).AddComponent<UIItem>();
                    } // end if
                    if (!item.gameObject.activeSelf) item.gameObject.SetActive(true);
                    // end if
                    item.SetSprite(sprite);
                    item.SetCount(count);
                } // end SetUIItem
예제 #26
0
            } // end LoginScene

            public void Initialize() {
                m_mainAudio = new MainAudio();
                m_mainCanvas = new MainCanvas();
                m_mainCamera = new MainCamera();
                m_mainAudio.PlayBackgroundMusic("login_scene_bgm");
                gameObject = ObjectTool.InstantiateGo("LoginSceneBg", ResourcesTool.LoadPrefabUI("login_scene_bg"), 
                    null, new Vector3(0, 0, 5.1f), Vector3.zero, Vector3.one);
                uiPanelFSM.PerformTransition(new UILoginPanel());
            } // end Initialize
예제 #27
0
 public PeaceNPCAvatar(string id, Animation avatar) : base(avatar) {
     avatar.AddClip(ResourcesTool.LoadAnimationClip(id + "_idle"), "idle");
     avatar.AddClip(ResourcesTool.LoadAnimationClip(id + "_run"), "run");
     avatar.AddClip(ResourcesTool.LoadAnimationClip(id + "_hurt"), "hurt");
     avatar.AddClip(ResourcesTool.LoadAnimationClip(id + "_die"), "die");
     foreach (AnimationState state in avatar) {
         state.speed = 0.5f;
     } // end foreach
 } // end PeaceNPCAvatar          
예제 #28
0
 // Use this for initialization
 void Start()
 {
     ResourcesTool.Init();
     Knackpack.Instance.Init(transform.Find(ResourcesTool.ResourceName.KnackpackPanel).Find(ResourcesTool.ResourceName.SlotPanel).gameObject);
     Chest.Instance.Init(transform.Find(ResourcesTool.ResourceName.Chest).Find(ResourcesTool.ResourceName.SlotPanel).gameObject);
     ToolTip.Instance.Init(transform.Find(ResourcesTool.ResourceName.ToolTip).gameObject);
     canvas     = GameObject.FindObjectOfType <Canvas>();
     pickedItem = new Slot(null, transform.Find(ResourcesTool.ResourceName.PickedItem).gameObject);
     ParseItemJson();
 }
예제 #29
0
                } // end DeleteRole

                private void OnClickStartGameBtn()
                {
                    if (!ChechExitID(roleindex))
                    {
                        ObjectTool.InstantiateGo("MessageBoxUI", ResourcesTool.LoadPrefabUI("message_box_ui"),
                                                 SceneManager.mainCanvas.rectTransform).AddComponent <UIMessageBox>().SetMessage("请选择角色");
                        return;
                    } // end if
                    GameManager.playerInfo.SelectedRole(roleindex, roleDict[roleindex][0], roleDict[roleindex][1]);
                    LoaderScene.LoadNextLevel(new NoviceVillage());
                } // end OnClickStartGameBtn
예제 #30
0
 public DemonBossAvatar(string id, Animation avatar) : base(avatar) {
     avatar.AddClip(ResourcesTool.LoadAnimationClip(id + "_idle"), "idle");
     avatar.AddClip(ResourcesTool.LoadAnimationClip(id + "_attack_1"), "attack_1");
     avatar.AddClip(ResourcesTool.LoadAnimationClip(id + "_run"), "run");
     avatar.AddClip(ResourcesTool.LoadAnimationClip(id + "_hurt"), "hurt");
     avatar.AddClip(ResourcesTool.LoadAnimationClip(id + "_die"), "die");
     avatar.AddClip(ResourcesTool.LoadAnimationClip(id + "_skill1"), "skill1");
     foreach (AnimationState state in avatar) {
         state.speed = 0.5f;
     } // end foreach
 } // end DemonBossAvatar