public void createMonsterRange(String mapId, String monsterId, int x, int y, int amount, int range) { CMonsterObject data = Program.objectsData[monsterId] as CMonsterObject; for (int i = 0; i < amount; i++) { CMonsterObject monster = new CMonsterObject(); monster.ObjectType = CObjectType.MONSTER; monster.ObjectId = System.Guid.NewGuid().ToString(); monster.Level = data.Level; monster.CharacterName = data.CharacterName; monster.ResourceId = data.ResourceId; monster.Action = CAction.STOP; monster.Direction = CDirection.RandomDirection(); Point pos = randomPointInCircle(x, y, range); monster.PosX = pos.x; monster.PosY = pos.y; monster.Speed = data.Speed; monster.HealthMax = data.HealthMax; monster.Health = data.Health; monster.ManaMax = data.ManaMax; monster.Mana = data.Mana; monster.AttackRange = data.AttackRange; monster.AttackSpeed = data.AttackSpeed; Program.objectList.Add(monster); Console.WriteLine("创建角色 " + monsterId + ",Guid:" + monster.ObjectId + ",X:" + monster.PosX + ",Y:" + monster.PosY); } }
private void ButtonLoad_Click(object sender, RoutedEventArgs e) { try { CSelectUserWindow selectUserWindow = new CSelectUserWindow(SelectQuery("SELECT * FROM USER")); selectUserWindow.ShowDialog(); if (selectUserWindow.Accept) { if (_basketUserControls[1].PriorityDirection != null) { _basketUserControls[1].Clear(); } _user = selectUserWindow.GetUser(); textBoxName.Text = _user.ID + " " + _user.Name; textBoxName.IsReadOnly = true; DataTable dataTableDirection = SelectQuery($"SELECT DIRECTION_SELECTION.ID, DIRECTION_SELECTION.PRIORITY, DIRECTION.NAME, DIRECTION.CODE, " + $"DIRECTION.ID AS DIRECTION_ID FROM DIRECTION_SELECTION, DIRECTION WHERE DIRECTION_SELECTION.ID_USER = { _user.ID} AND " + $"DIRECTION.ID = DIRECTION_SELECTION.ID_DIRECTION"); DataTable dataTableProfile = SelectQuery($"SELECT PROFILE_SELECTION.ID, PROFILE_SELECTION.PRIORITY, PROFILE.NAME AS PROFILE_NAME, " + $"FACULTY.NAME AS FACULTY_NAME, PROFILE.ID AS PROFILE_ID, DIRECTION_SELECTION.ID AS DIRECTION_SELECTION_ID FROM DIRECTION_SELECTION, " + $"PROFILE_SELECTION, PROFILE, FACULTY WHERE DIRECTION_SELECTION.ID_USER = { _user.ID} AND DIRECTION_SELECTION.ID = PROFILE_SELECTION.ID_SELECTION AND " + $"PROFILE_SELECTION.ID_PROFILE = PROFILE.ID AND PROFILE.ID_FACULTY = FACULTY.ID"); int iCount = 0; foreach (DataRow dataRow in dataTableDirection.Rows) { CDirection direction = new CDirection((string)dataRow[2], (string)dataRow[3]); DataRow row = dataTableProfile.Rows[iCount]; CProfile profile = new CProfile((string)row[2], (string)row[3], Convert.ToInt32(row[4])); CDirectionWithProfile directionWithProfile = new CDirectionWithProfile(direction, profile, Convert.ToInt32(dataRow[4])); while (iCount < dataTableProfile.Rows.Count - 1) { if (Convert.ToInt32(dataRow[0]) == Convert.ToInt32(dataTableProfile.Rows[iCount + 1].ItemArray[5])) { iCount++; row = dataTableProfile.Rows[iCount]; profile = new CProfile((string)row[2], (string)row[3], Convert.ToInt32(row[4])); directionWithProfile.PriorityProfile.AddProfile(profile); } else { iCount++; break; } } _basketUserControls[1].Add(directionWithProfile, false); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static Vector3 GetDirectionVector(CDirection aDirection) { switch (aDirection) { case CDirection.cUp: return(Vector3.up); case CDirection.cDown: return(Vector3.down); } return(Vector3.zero); }
Vector3 GetDirectionVector(CDirection aDirection) { switch (aDirection) { case CDirection.cLeft: return(Vector3.left); case CDirection.cRight: return(Vector3.right); } Debug.LogError("DirectionがNoneです", this); return(Vector3.zero); }
private void OnOffRewardGroup(bool b, bool isInstantly = false) { iTween.Stop(m_objArray[(int)OBJECT_TYPE.TYPE_REWARD]); CDirection cDirection = m_objArray[(int)OBJECT_TYPE.TYPE_REWARD].GetComponent <CDirection>(); if (isInstantly) { cDirection.ResetToBeginning(b ? 100000131 : 100000132); } else { cDirection.SetInit(b ? 100000131 : 100000132, true); } }
private void OnOffTitleGroup(bool b, bool isInstantly = false) { iTween.Stop(m_objArray[(int)OBJECT_TYPE.TYPE_TITLE]); CDirection cDirection = m_objArray[(int)OBJECT_TYPE.TYPE_TITLE].GetComponent <CDirection>(); if (isInstantly) { cDirection.ResetToBeginning(b ? 100000129 : 100000130); } else { cDirection.SetInit(b ? 100000129 : 100000130, true); } }
private void OnOffSkipButton(bool b, bool isResetToBeginning = false) { iTween.Stop(m_skipButton); int dirNum = b ? 100000077 : 100000078; CDirection cDirection = m_skipButton.GetComponent <CDirection>(); if (isResetToBeginning) { cDirection.ResetToBeginning(dirNum); } else { cDirection.SetInit(dirNum, true); } }
public UIIcon(GameObject obj, UICommonMenuGroup.ICON_TYPE type, UIEventListener.VoidDelegate deleage) { m_type = type; m_obj = obj; m_transform = obj.transform; m_icon = m_transform.FindChild("Icon").GetComponent <UISprite>(); m_new = m_transform.FindChild("New"); m_lock = m_transform.FindChild("Lock_Group"); if (m_lock != null) { m_lockSprite = m_lock.FindChild("Lock").GetComponent <UISprite>(); } m_transform.GetComponent <UIEventListener>().onClick = deleage; m_cDirection = m_obj.AddComponent <CDirection>(); }
void Awake() { m_vMovePos = Vector3.zero; m_transform = transform; #region Label string[] labelPathArray = { "Name", "Desc", "Manage_Group/Manage_Value", "Manage_Group/User_Exp_Value", "Manage_Group/Ap_Value", "Manage_Group/Dog_Exp_Value", "Potion_Group/Ap_Value", "Cloth_Group/Cloth01/Value", "Cloth_Group/Cloth02/Value", "Interior_Group/Point/Value", "Interior_Group/Size", "Receipe_Group/Text", "All_Group/Ticket_Value", "All_Group/Ap_Value" }; m_labelArray = new UILabel[(int)LABEL_TYPE.TYPE_END]; for (int i = 0; i < labelPathArray.Length; i++) { m_labelArray[i] = m_transform.FindChild(labelPathArray[i]).GetComponent <UILabel>(); } #endregion #region Sprite string[] spritePathArray = { "Background", "Manage_Group/Manage_Icon/Icon", "Cloth_Group/Cloth01/Icon", "Cloth_Group/Cloth02/Icon" }; m_spriteArray = new UISprite[(int)SPRITE_TYPE.TYPE_END]; for (int i = 0; i < spritePathArray.Length; i++) { m_spriteArray[i] = m_transform.FindChild(spritePathArray[i]).GetComponent <UISprite>(); } #endregion #region Object string[] objectPathArray = { "Manage_Group", "Potion_Group", "Cloth_Group", "Interior_Group", "Receipe_Group", "All_Group", "Interior_Group/Reward/Ap", "Interior_Group/Reward/Exp", "Interior_Group/Reward/None" }; m_objectArray = new GameObject[(int)OBJECT_TYPE.TYPE_END]; for (int i = 0; i < objectPathArray.Length; i++) { m_objectArray[i] = m_transform.FindChild(objectPathArray[i]).gameObject; } m_cDirection = gameObject.GetComponent <CDirection>(); #endregion }
public UIWindow(UIPhotoStudioResult popup, GameObject obj) { m_popup = popup; m_obj = obj; m_transform = obj.transform; m_topButtonGroup = m_transform.FindChild("Anchor_Top/Button_Group"); m_topButtonGroupDir = m_topButtonGroup.GetComponent <CDirection>(); m_botButtonGroup = m_transform.FindChild("Anchor_Bottom/Button_Group"); m_botButtonGroupDir = m_botButtonGroup.GetComponent <CDirection>(); m_uiImageFilter = new UIPhotoStudioImageFilter(popup, m_transform.FindChild("Anchor_Bottom/UIPhotoStudioImageFilter").gameObject); m_uiEmojiPopup = m_transform.FindChild("Anchor_Bottom/UIPhotoStudioEmoji").GetComponent <EmojiPopup>(); m_spriteArray = new UISprite[(int)SPRITE_TYPE.TYPE_END]; string[] spritePathArray = { "Anchor_Top/Button_Group/BeforeButton", "Anchor_Top/Button_Group/AfterButton" }; for (int i = 0; i < spritePathArray.Length; i++) { m_spriteArray[i] = m_transform.FindChild(spritePathArray[i]).GetComponent <UISprite>(); } m_buttonArray = new GameObject[(int)BUTTON_TYPE.TYPE_END]; string[] objectPathArray = { "Anchor_Top/Button_Group/BeforeButton", "Anchor_Top/Button_Group/AfterButton", "Anchor_Bottom/Button_Group/SaveButton", "Anchor_Bottom/Button_Group/CancelButton", "Anchor_Bottom/Button_Group/EmojiButton", "Anchor_Bottom/Button_Group/FilterButton", "Anchor_Bottom/Button_Group/ConfirmButton" }; UIEventListener.VoidDelegate[] eventArray = { popup.OnBeforeButton, popup.OnAfterButton, popup.OnSaveButton, popup.OnCloseButton, popup.OnEmojiButton, popup.OnFilterButton, popup.OnConfirmButton }; for (int i = 0; i < objectPathArray.Length; i++) { m_buttonArray[i] = m_transform.FindChild(objectPathArray[i]).gameObject; m_buttonArray[i].GetComponent <UIEventListener>().onClick = eventArray[i]; } }
public void Init(Transform parent) { SetParentPanelOption(parent); m_transform.parent = parent; m_transform.localPosition = Vector3.zero; m_transform.localScale = Vector3.one; m_cDirection = m_obj.GetComponent <CDirection>(); #region Label m_labelArray = new UILabel[(int)LABEL_TYPE.TYPE_END]; string[] labelPathArray = { "Level", "Point_Group/InteriorPoint_Value", "Point_Group/SocialPoint_Value", "Name" }; for (int i = 0; i < labelPathArray.Length; i++) { m_labelArray[i] = m_transform.FindChild(labelPathArray[i]).GetComponent <UILabel>(); } #endregion #region Object m_icon = m_transform.FindChild("Photo").GetComponent <UIProfileTextureIcon>(); m_levelSlider = m_transform.FindChild("Level_Slider").GetComponent <UISlider>(); m_transArray = new Transform[(int)TRANSFORM_TYPE.TYPE_END]; string[] transPathArray = { "Level_Slider/Star", "Point_Group/InteriorPoint_Icon", "Point_Group/SocialPoint_Icon", "Normal_Background", "Special_Background", "Point_Group", "Friend_Button", "BtnMainDog", "Frame/SpriteNew" }; for (int i = 0; i < transPathArray.Length; i++) { m_transArray[i] = m_transform.FindChild(transPathArray[i]); } m_transArray[(int)TRANSFORM_TYPE.TYPE_FRIEND_BUTTON].GetComponent <UIEventListener>().onClick = OnSendUserDogInfo; m_transArray[(int)TRANSFORM_TYPE.TYPE_DOG_BUTTON].gameObject.AddComponent <UIEventListener>().onClick = OnClickMainDog; #endregion SetActive(parent != null); }
/// <summary> /// Конструктор класса /// </summary> /// <param name="direction">Направление</param> /// <param name="profiles">Список профилей</param> public CDirectionWithProfile(CDirection direction, CPriorityProfile priorityProfile, int id) { _direction = direction; _priorityProfile = priorityProfile; _id = id; }
static bool IsThrough(CDirection aDirection, Vector3 aVec) { return(Vector3.Dot(GetDirectionVector(aDirection), aVec) > 0.0f); }
private void Load() { DataTable dataTableDirection = SelectQuery("SELECT DIRECTION.ID, DIRECTION.NAME, DIRECTION.CODE FROM DIRECTION"); DataTable dataTableProfile = SelectQuery("SELECT DIRECTION.ID, PROFILE.NAME, FACULTY.NAME, PROFILE.ID FROM CATALOG " + "JOIN DIRECTION ON CATALOG.ID_DIRECTION = DIRECTION.ID " + "JOIN PROFILE ON CATALOG.ID_PROFILE = PROFILE.ID " + "JOIN FACULTY ON PROFILE.ID_FACULTY = FACULTY.ID"); CPriorityDirection priorityDirection; List <CDirection> directions = new List <CDirection>(); List <CProfile> profiles = new List <CProfile>(); foreach (DataRow dataRowDirection in dataTableDirection.Rows) { directions.Add(new CDirection((string)dataRowDirection[1], (string)dataRowDirection[2])); } foreach (DataRow dataRowProfile in dataTableProfile.Rows) { profiles.Add(new CProfile((string)dataRowProfile[1], (string)dataRowProfile[2], Convert.ToInt32(dataRowProfile[3]))); } List <CDirectionWithProfile> directionWithProfiles = new List <CDirectionWithProfile>(); for (int i = 0; i < profiles.Count; i++) { if (directionWithProfiles.Count != 0) { if (directionWithProfiles[directionWithProfiles.Count - 1].ID == Convert.ToInt32(dataTableProfile.Rows[i].ItemArray[0])) { directionWithProfiles[directionWithProfiles.Count - 1].PriorityProfile.AddProfile(profiles[i]); continue; } } CDirection direction = directions[Convert.ToInt32(dataTableProfile.Rows[i].ItemArray[0])]; CProfile profile = profiles[i]; int id = Convert.ToInt32(dataTableProfile.Rows[i].ItemArray[0]); CDirectionWithProfile directionWithProfile = new CDirectionWithProfile(direction, profile, id); directionWithProfiles.Add(directionWithProfile); } priorityDirection = new CPriorityDirection(directionWithProfiles[0]); for (int i = 1; i < directionWithProfiles.Count; i++) { priorityDirection.AddDirection(directionWithProfiles[i]); } СBasketUserControl basketUserControl = new СBasketUserControl(priorityDirection, true); basketUserControl.HorizontalAlignment = HorizontalAlignment.Left; basketUserControl.VerticalAlignment = VerticalAlignment.Top; basketUserControl.Margin = new Thickness(0, 79, 0, 0); basketUserControl.SetSizeHorizontsly(390); basketUserControl.SetSizeVerticals(Height - 150); basketUserControl.ButtonAdd += TransferDirectionWithProfile; _basketUserControls.Add(basketUserControl); ((Grid)this.Content).Children.Add(basketUserControl); basketUserControl = new СBasketUserControl(); basketUserControl.HorizontalAlignment = HorizontalAlignment.Left; basketUserControl.VerticalAlignment = VerticalAlignment.Top; basketUserControl.Margin = new Thickness(390, 79, 0, 0); basketUserControl.SetSizeHorizontsly(390); basketUserControl.SetSizeVerticals(Height - 150); basketUserControl.ButtonAdd += TransferDirectionWithProfile; _basketUserControls.Add(basketUserControl); ((Grid)this.Content).Children.Add(basketUserControl); }